Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Samsung My Files explorer: Pick file Intent

I would like to start an intentchooser which can return any kind of file. The following code works with the usual file explorers (ES, Astro, etc.) but not with the built-in samsung My Files explorer.

Intent selectFile = new Intent(Intent.ACTION_GET_CONTENT);
selectFile.setType("file/*");
startActivityForResult(Intent.createChooser(selectFile, "Select File"), SELECT_FILE);

Does anyone know how to handle that samsung explorer? I tried to use Intent selectFile = new Intent( "com.sec.android.app.myfiles.PICK_DATA") but it doesn't seem to work.

Any ideas? Thanks.

Update: I used this code

Intent selectFile = new Intent();
selectFile.setAction("com.sec.android.app.myfiles.PICK_DATA");
startActivityForResult(selectFile, SELECT_FILE);

but I get this error: FORWARD_RESULT_FLAG used while also requesting a result. Anyone know what does this mean?

like image 434
steliosf Avatar asked May 05 '12 15:05

steliosf


1 Answers

Intent samsungIntent = new Intent();
samsungIntent.setAction("com.sec.android.app.myfiles.PICK_DATA");
samsungIntent.putExtra("CONTENT_TYPE", "*/*");

Changing from setType to putExtra does the trick.

like image 184
Konrad Nowicki Avatar answered Oct 31 '22 17:10

Konrad Nowicki