ACTION_IMAGE_CAPTURE & ACTION_VIDEO_CAPTURE
In my application, I am using "android.provider.MediaStore.ACTION_IMAGE_开发者_JS百科CAPTURE & ACTION_VIDEO_CAPTURE" intents to take pictures and videos which will then be send over to the backend.
How do I retrieve the default pathname of the intents? One way is to use "putExtra(android.provider.MediaStore.EXTRA_OUTPUT, uri)" but then if I take a picture it is saved twice, one in the specified uri and another in the dafault path (/sdcard/DCIM/CAMERA...).
Is there any way where after taking the picture (the sending to the backend is already done) I can retrieve the default path and then delete that image/video?
Also I noticed that when calling "protected void onActivity (int requestcode ....)", I can only do so for either the camera or video intent. Within the same method, the application crashes.
How do I handle multiple intents?
Thanks In Advance, Perumal
If you dont want to store Image in default location then start native camera app using following coding snippet
Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(camera, PHOTO_REQCOD);
In Your OnActivityResult callback you can retrieve bitmap as follows.
Bundle b = data.getExtras();
Bitmap bitmap_photo = (Bitmap) b.get("data");
I did this in one of projects. Enjoy..
精彩评论