android-camera

Taking a high quality image through default camera activity and saving it o the sd card

怎甘沉沦 提交于 2019-12-24 10:19:34
问题 I am taking a high resolution picture through the default camera activity(using intent.put Extras ),and saving it to the sd card, Code: public class CameraActivity extends Activity implements OnClickListener { /** Called when the activity is first created. */ Button takepicture ; ImageView iv ; TextView tv; Button show; String filepath; Intent i; Uri mUri; final static int cameraData = 0; File folder = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Continuously take still photo with android Camera2

心已入冬 提交于 2019-12-24 09:30:00
问题 From Camera2Basic example, I modified the code to make the program continuously takes still photo every 2 seconds. It runs fine but after a while it enters the same statecallback condition and does not take picture anymore: case STATE_WAITING_PRECAPTURE: { // CONTROL_AE_STATE can be null on some devices Integer aeState = result.get(CaptureResult.CONTROL_AE_STATE); if (aeState == null || aeState == CaptureResult.CONTROL_AE_STATE_PRECAPTURE || aeState == CaptureRequest.CONTROL_AE_STATE_FLASH

Android: Camera preview Rotated

早过忘川 提交于 2019-12-24 09:16:11
问题 i am facing a problem in my application, i am using this for the camera preview, but in the camera preview even the person standing vertically is appearing to stand horizontally... , it seems i am missing something in my preview mSurfaceView = (SurfaceView)findViewById(R.id.surface); mSurfaceHolder = mSurfaceView.getHolder(); mSurfaceHolder.addCallback(this); mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); plz help me out , thanx 回答1: Give this a try: http://developer.android

Android: Customize photo size

痞子三分冷 提交于 2019-12-24 08:57:16
问题 I have one application in which mobile capture photo then it upload to the server. I want to check the size of photo first then reduce photo size to some particular size depending on actual photo size. Actually on server it not allow photo which have greater than some particular size (say 200 kb). Or can I restrict the camera to capture photo only in particular size even some one change the setting of camera. lot of question ask here which retrieve width and height of the photo. But I want to

Getting captured image in onActivityResult method

依然范特西╮ 提交于 2019-12-24 08:31:55
问题 i have small doubt in the below code @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent i=new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(i, 0); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if(requestCode==0 && resultCode==RESULT_OK ){ Bundle extras = data.getExtras(); //get the

On some devices, Google Mobile Visions CameraSource returns low resolution image after calling takePicture

隐身守侯 提交于 2019-12-24 07:47:14
问题 After I call: cameraSource.takePicture(null, pictureCallback); in the callback: private CameraSource.PictureCallback pictureCallback = new CameraSource.PictureCallback() { @Override public void onPictureTaken(byte[] bytes) { try { Log.d(DEBUG_TAG, "On picture taken."); if (bytes == null) { return; } Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); Glide.with(this).load(bitmap).into(capturedImg); }catch (Exception ex){ ex.printStackTrace(); Log.e("PictureTaken",ex

CameraX chooses low resolution for given aspect ratio

半腔热情 提交于 2019-12-24 07:34:34
问题 I want to get the best quality for square aspect ratio and setup the next preview and capture configs for CameraX. val SQUARE_ASPECT_RATIO = Rational(1, 1) val previewConfig = PreviewConfig.Builder().apply { setTargetAspectRatio(SQUARE_ASPECT_RATIO) setTargetRotation(viewFinder.display.rotation) }.build() preview = Preview(previewConfig) val imageCaptureConfig = ImageCaptureConfig.Builder().apply { setCaptureMode(ImageCapture.CaptureMode.MAX_QUALITY) setTargetAspectRatio(SQUARE_ASPECT_RATIO)

Proper solution to pick/click an image on Android

半世苍凉 提交于 2019-12-24 06:45:59
问题 As the title suggests, i'm having an option to upload an image in my app. I would like to have two options: Click a new picture & Select from gallery. Gallery selection is working fine on all devices using this code: Intent in = new Intent(); in.setType("image/*"); in.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(in, getString(R.string.selectpicture)), 100); The problem is with Click a new picture . I want to use other camera apps installed on the device to

How to add gallery button to Camera open with intent?

∥☆過路亽.° 提交于 2019-12-24 04:40:53
问题 In my app users are able to make a photo with camera. And I start it using intents: Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); Now when open camera lacks the gallery button which would allow user to pick one of existing images from his SD card. Is it possible to show this button? 回答1: You can't really change the things camera intent has to offer, and if you do find a device where the camera app would let you access the gallery I wouldn't depend on it. I would recommend that

Access denied for property “vendor.camera.aux.packagelist”

做~自己de王妃 提交于 2019-12-24 04:06:33
问题 The application runs but when i try to use the camera only a disturbed grey screen appears and the logs tab gives me two errors: E/libc: Access denied finding property "vendor.camera.aux.packagelist" Access denied finding property "vendor.camera.aux.packagelist2" AndroidManifest.xml <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.CAMERA" /> build.gradle (Module:app) apply plugin: 'com.android.application' android {