Reputation: 820
I would like to get a nicer file explorer as the one which is chosen automatically by Intent. On my phone there is also the file explorer from Samsung. However it never shows up.
Here my code snippet in Kotlin
val intent = Intent(Intent.ACTION_GET_CONTENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
data = selectedUri
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
}
Upvotes: 0
Views: 949
Reputation: 161
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(intent, REQUEST_CODE);
For Samsung Users
val intent = new Intent("com.sec.android.app.myfiles.PICK_DATA");
intent.putExtra("CONTENT_TYPE", "*/*");
intent.addCategory(Intent.CATEGORY_DEFAULT);
For more refernce check http://developer.android.com/guide/topics/providers/document-provider.html
Upvotes: 2