I am working with pdf files in my android app. In a Alert Dialog pressing "Yes" should open the pdf file location in default file manager app.
I tried with this but it always open a chooser. Even-though it(ES File Explorer) opens with "Choose Path" dialog not the folder in the app as normal way of accessing folder.
So, is there possible to open directly the content of folder in "Default File Manager"? Or can open with chooser , from that selected app it should show the pdf file chooser when selecting the pdf file?.
Below is my try to achieve this.
public void openFolder(String filePath)
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(filePath.substring(0, filePath.lastIndexOf("/")));
intent.setDataAndType(uri, "*/*");//tried with application/pdf and file/*
intent.addCategory(Intent.CATEGORY_OPENABLE);
PackageManager pm = context.getPackageManager();
List<ResolveInfo> apps =
pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (apps.size() > 0)
startActivity(intent);//Intent.createChooser(intent, "Open folder"
}
Edited And I tried with ACTION_PICK too. Its directed to specific folder of default file manager.But from there selecting a file not open the chooser (pdf viewer list dialog).