-->

How to add gallery button to Camera open with inte

2019-07-09 05:36发布

问题:

In my app users are able to make a photo with camera. And I start it using intents:

Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);

Now when open camera lacks the gallery button which would allow user to pick one of existing images from his SD card. Is it possible to show this button?

回答1:

You can't really change the things camera intent has to offer, and if you do find a device where the camera app would let you access the gallery I wouldn't depend on it.

I would recommend that whenever your user taps on the button or whatever launches the Camera Intent, launch a dialog that asks you the user to choose, "New Photo" or "Existing Photo". If they choose existing, launch the gallery intent.

Here is a really good tutorial for the gallery intent.

http://www.helloandroid.com/tutorials/gallery-intent-tutorial

Good Luck!



回答2:

If you really want to have a button that links to the gallery while the user is in the Camera view, then you probably will need to create a custom camera activity. Android docs has a good explanation of how to get started: http://developer.android.com/training/camera/cameradirect.html