Samsung Explorer requires not only a custom action ( com.sec.android.app.myfiles.PICK_DATA ), but also part of the category (Intent. CATEGORY_DEFAULT ) and mime-type, which should be passed as optional.
Intent intent = new Intent("com.sec.android.app.myfiles.PICK_DATA"); intent.putExtra("CONTENT_TYPE", "*/*"); intent.addCategory(Intent.CATEGORY_DEFAULT);
You can also use this action to open several files: com.sec.android.app.myfiles.PICK_DATA_MULTIPLE Anyway, here is my solution that works on Samsung and other devices:
public void openFile(String mimeType) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType(mimeType); intent.addCategory(Intent.CATEGORY_OPENABLE); // special intent for Samsung file manager Intent sIntent = new Intent("com.sec.android.app.myfiles.PICK_DATA"); // if you want any file type, you can skip next line sIntent.putExtra("CONTENT_TYPE", mimeType); sIntent.addCategory(Intent.CATEGORY_DEFAULT); Intent chooserIntent; if (getPackageManager().resolveActivity(sIntent, 0) != null){ // it is device with Samsung file manager chooserIntent = Intent.createChooser(sIntent, "Open file"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Intent[] { intent}); } else { chooserIntent = Intent.createChooser(intent, "Open file"); } try { startActivityForResult(chooserIntent, CHOOSE_FILE_REQUESTCODE); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(getApplicationContext(), "No suitable File Manager was found.", Toast.LENGTH_SHORT).show(); } }
This solution works well for me, and may be useful for someone else.
Chupik Jul 30 '13 at 14:30 2013-07-30 14:30
source share