开发者

how to handle camera intent android

开发者 https://www.devze.com 2023-03-15 19:35 出处:网络
I was working on some camera stuff in android and i get some tutorials. For my needs i get the following code to be used:

I was working on some camera stuff in android and i get some tutorials.

For my needs i get the following code to be used:

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
startActivityForResult(cameraIntent, CAMERA_PIC_RE开发者_如何学PythonQUEST);

But using this when i capture the image, this Intent automatically stores the Image in my SD CARD. but i dont want it to store it to my SD CARD because i am storing that image to some other place/folder in SD Card. So is it possible in here that i can stop this intent to store the image into SDCard automatically.

Please Friends Help


use this . It will save the image to any myfolder in your SDCard.

String imageFilePath = Environment.getExternalStorageDirectory().getAbsolutePath()
+ "/myfolder/myfavoritepicture.jpg";
File imageFile = new File(imageFilePath);
Uri imageFileUri = Uri.fromFile(imageFile);
Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri);
startActivityForResult(i, CAMERA_RESULT);
0

精彩评论

暂无评论...
验证码 换一张
取 消