Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open file picker form my Android activity

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!

like image 819
Carlo Moretti Avatar asked Nov 30 '22 23:11

Carlo Moretti


1 Answers

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

like image 184
user370305 Avatar answered Dec 15 '22 20:12

user370305