Open file picker form my Android activity

Onheiron picture Onheiron · Aug 30, 2012 · Viewed 21.5k times · Source

I'm making an Android app which stores some downloaded pdf files inside the device's SD card. Everything works fine, but now I want to add a function to just pop up the default android file/folder browser showing the directory where my app stores all the PDF (with subdirectories in it) so that the user sees where his documents are stored and can easily browse them.

I've been throught many other SO questions and forum posts, but it seems this can only be done for music/images/contacts/etc. basically those file types which have a 'dedicated browsing system' but not with general file browsing.

I'm actually using this code:

File file = new File("/sdcard/MySorgenia/Documenti/");
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
Uri data = Uri.fromFile(file);
String type = "*/*";
intent.setDataAndType(data, type);
startActivity(intent);

But this will show me a "Choose the application to complete your action" dialog with many applications such as "Music" "Gallery" etc, but no general purpose one.

Thanks!

Answer

user370305 picture user370305 · Aug 30, 2012

Because In android there is no any native application which you can use as a File Explorer and responds to Intent type "*/*"

Implement your own File-Explorer Code for this purpose..

Look at these two Links..

  1. openintents

  2. Android-File-Explore