I downloaded a file for user , now I want to navigate user to the specific folder where file was downloaded . I searched a lot and this was the best I could come up with
public static void openASpecificFolderInFileManager(Context context, String path) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
i.setDataAndType(Uri.parse(path), "resource/folder");
if (i.resolveActivityInfo(context.getPackageManager(), 0) != null) {
context.startActivity(Intent.createChooser(i, "Open with"));
} else {
Toast.makeText(context, "File Manager not found ", Toast.LENGTH_SHORT).show();
}
}
This works fine for specific file explorers (like ES filemanager) but doesn't work with default android file managers .
NOTE: I do not want to pick a file. I just want to open specific folder so user can view files
Is there any way I can achieve it with default file explorers ?