0

I wish to open android default gallery on specific folder. The folder contains images and videos. I can open the galley with:

Intent i=new Intent(Intent.ACTION_PICK);
i.setType("media/*");
startActivity(i);

but how to do it in specific folder? I do not wish to read back the image or video viewed, just open it.

Dim
  • 4,527
  • 15
  • 80
  • 139

1 Answers1

1

You can try following code.

public void openFolder()
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
    + "/myFolder/");

intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "Open folder"));
}

Permisson in manifest.xml

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

Also refer this.

Community
  • 1
  • 1
Hardik Joshi
  • 9,477
  • 12
  • 61
  • 113