Reputation: 1427
I found several ways to select pictures from the gallery, but I need to select a folder, I´m trying with:
Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
intent.setDataAndType(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, DocumentsContract.Document.MIME_TYPE_DIR);
startActivityForResult(intent , 0);
and
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
switch(requestCode) {
case 0:
if(resultCode == RESULT_OK){
Uri selectedImage = imageReturnedIntent.getData();
Log.v("test", selectedImage.toString());
}
break;
}
}
But I'm getting the following error:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.PICK dat=content://media/... typ=vnd.android.document/directory }
Upvotes: 0
Views: 39