Get/pick an image from Android's built-in Gallery app programmatically

前端 未结 19 1206
终归单人心
终归单人心 2020-11-22 00:49

I am trying to open an image / picture in the Gallery built-in app from inside my application.

I have a URI of the picture (the picture is located on the SD card).

19条回答
  •  别那么骄傲
    2020-11-22 01:11

    There are two useful tutorials about image picker with downloadable source code here:

    How to Create Android Image Picker

    How to Select and Crop Image on Android

    However, the app will be forced to close sometime, you can fix it by adding android:configChanges attribute into main activity in Manifest file like as:

    
    

    It seems that the camera API lost control with orientation so this will help it. :)

提交回复
热议问题