简体   繁体   English

android如何处理相机意图

[英]how to handle camera intent android

I was working on some camera stuff in android and i get some tutorials. 我正在研究android中的一些相机东西,并获得了一些教程。

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_REQUEST);

But using this when i capture the image, this Intent automatically stores the Image in my SD CARD. 但是,当我捕获图像时使用此功能,此意图会自动将图像存储在我的SD卡中。 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. 但是我不希望它将其存储到我的SD卡中,因为我将该图像存储到SD卡中的其他位置/文件夹中。 So is it possible in here that i can stop this intent to store the image into SDCard automatically. 所以在这里我可以停止将图像自动存储到SDCard的意图。

Please Friends Help 请朋友帮忙

use this . 用这个 。 It will save the image to any myfolder in your SDCard. 它将图像保存到SD卡中的任何myfolder中。

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM