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

前端 未结 19 1147
终归单人心
终归单人心 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:22

    To display images and videos try this:

        Intent intent = new Intent();
        intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        startActivityForResult(intent, 1);
        startActivityForResult(Intent.createChooser(intent,"Wybierz plik"), SELECT_FILE);
    

提交回复
热议问题