0

How can I open/view an image in default gallery application using Intent. The following code opens up gallery App but does not show any image. I am new to android programming. Any help would be grateful. :)

            Intent intent = new Intent(Intent.ACTION_VIEW);
            String path = Environment.getExternalStorageDirectory().getPath().toString() + "/my_folder/" + filename;
            intent.setDataAndType(Uri.parse(test),"image/*");
            startActivity(intent);
yadhuz
  • 11
  • 6
  • try adding `intent.setFlags(FLAG_GRANT_READ_URI_PERMISSION | FLAG_GRANT_WRITE_URI_PERMISSION);` before starting activity – Firerazzer May 30 '17 at 14:19
  • 2
    Possible duplicate of [Open gallery app from Android Intent](https://stackoverflow.com/questions/16928727/open-gallery-app-from-android-intent) – Simo May 30 '17 at 14:22
  • That didn't help me Firerazzer. – yadhuz May 31 '17 at 02:42

0 Answers0