Android where can I get image taken by native camera app

北慕城南 提交于 2019-12-20 06:49:20

问题


I am using native camera app to capture image, And I am not using MediaStore.EXTRA_OUTPUT to specify the path of image. Then how can i get the image using the intent.

Thanks.


回答1:


To capture images using camera call this intent

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, requestCode);

and to handle the callback use onActivityResult function

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

Bitmap mImageBitmap;
            Bundle extras = data.getExtras();
            mImageBitmap = Bitmap.createScaledBitmap(
                    (Bitmap) extras.get("data"), 100, 100, false);
}

mImageBitmap will hold the image that you captured. Hope it helps :)




回答2:


Have a look at this topic. What do you mean by you are not using the MediaStore.EXTRA_OUTPUT? After can get the image data back via callback and save it as picture in a custom location.



来源:https://stackoverflow.com/questions/14725291/android-where-can-i-get-image-taken-by-native-camera-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!