1

I'm trying to pick a file via an Intent. What I tryed till now is this:

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
startActivityForResult(intent, FILE_SELECT_CODE);

But with this, I can only pic Photos with the galery app.

My goal is to pic ANY file via the standard file manager of Android/Samsung.

This didn't work either:

String manufactures = android.os.Build.MANUFACTURER;
if(manufactures.equalsIgnoreCase("samsung"))
{
    Intent intent = new Intent("com.sec.android.app.myfiles.PICK_DATA");
    intent.putExtra("CONTENT_TYPE", "*/*");
    startActivityForResult(intent, FILE_SELECT_CODE);
}

Thx for your help!

Pixel_95
  • 759
  • 1
  • 8
  • 19

1 Answers1

4

My goal is to pic ANY file via the standard file manager of Android/Samsung.

Android does not have a "standard file manager".

If your minSdkVersion is 19 or higher, you are welcome to use the Storage Access Framework (e.g., ACTION_OPEN_DOCUMENT), which is the closest thing that Android now has to a "standard file manager".

Otherwise, you are limited to whatever ACTION_GET_CONTENT-supporting apps that the user has installed, or creating your own file-selection UI, or using one of many existing libraries for selecting files.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
  • Thx for your answer. What is just tryed i is: Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.addCategory(Intent.CATEGORY_OPENABLE); intent.setType("*/*"); startActivityForResult(intent, FILE_SELECT_CODE); but then, the app crashes ... – Pixel_95 Sep 29 '15 at 08:43
  • @Pixel_95: Use LogCat to examine the Java stack trace associated with your crash: http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this If you do not understand what you are seeing, post a separate Stack Overflow question where you provide your current code along with that stack trace. – CommonsWare Sep 29 '15 at 11:07
  • it says "java.lang.IllegalStateException: Could not execute method of the activity" in the last line of the code, i just posted – Pixel_95 Sep 29 '15 at 11:13