I am using this code:
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
File photo = new File("/sdcard/picture.png");
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(photo));
Uri imageUri = Uri.fromFile(photo);
startActivity(intent);
I would like to use this intent with a pre-defined setting, like front facing by default every time I fire the camera. Is that possible?
This is the front Camera intent, use it in your code!
here is an good tutorial: http://www.vogella.com/articles/AndroidCamera/article.html
int CAMERA_FACING_FRONT
Read more here: http://developer.android.com/reference/android/hardware/Camera.html
Related
I'm using this code to open camera intent :
Intent takePicture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
takePicture.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
startActivityForResult(takePicture, 0);
And it works fine but only on Samsung devices (8\9) with android 8
after I take a picture the preview is all blurry ,
anyone got that weird behavior ?
( I also tried without the putExtra line )
Here are the screenshots :
]3
you have to give a photo path Uri as an extra in the camera intent as:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = new File(Environment.getExternalStorageDirectory(), mUserID + ".jpg");
Uri photoPath = getUriForFile(mContext, BuildConfig.APPLICATION_ID, file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, photoPath); //--> here
startActivityForResult(Intent.createChooser(intent, "Complete action using"), REQUEST_CODE_CAMERA);
then, you can get the captured image in that Uri itself in onActivityResult
how to use setmaxvideoDuration to record a video using camera-kit sdk?
You can set the duration limit code below.
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
intent.putExtra("android.intent.extra.durationLimit", maxDurationMiliSecond);
startActivityForResult(intent, ActivityRequests.REQUEST_TAKE_VIDEO);
I tried other questions' methods, but for me, these methods do not work .
I want to use intent to start front camera. I try to do it
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra("android.intent.extras.CAMERA_FACING",1);
mFile = Utils.getVisitorImage();
Uri imageUri = FileProvider.getUriForFile(
getActivity(),
getActivity().getPackageName() + ".fileprovider",
mFile);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, CAMERA_PHOTO_REQUEST_CODE);
but,it does't work. my device is Android 7.1.1 or some device higher 6.0.1.
How to use intent start front camera? I hope someone help me.Thanks.
I have a problem, it is i using camera of android with call MediaStore.ACTION_IMAGE_CAPTURE
Intent cameraIntent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
filepath = getOutputMediaFile();
uri = Uri.fromFile(filepath);
cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, uri);
startActivityForResult(cameraIntent, 0);
When i capture and then it don't auto save, i must be click to buttom save or buttom not, while i just need to save.
Button save and button not
This not comfortable, so how to set auto save and pretermit this step?
That's a function of the camera app. You would have to wrote your own code for capturing an image with the camera.
I am trying to programatically launch or open the photo gallery after passing a photo name search parameter.
I am new at this. I am thinking maybe intents can be used but not sure so I am wondering if anyone could please point me in the right direction. Preferably with some code examples.
Much thanks.
RE-EDIT
As requested, this is the code I have so far..
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
// CAMERA_PIC_REQUEST = 2600;
cameraIntent = Intent.createChooser(intent,"Select Picture");
you can try follow code:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(photoUri);
context.startActivity(intent);
I think this is what you mean, correct me if I'm wrong:
String nameOfPhotoToBeRetrieved = "myPhoto";
String WHERE = "TITLE ="+nameOfPhotoToBeRetrieved;
Then you can use the following line to deliver a result to your cursor/listener:
CursorLoader(context,content_uri,null,WHERE,null,null).deliverResult(myCursor);