Reputation: 3047
I am trying to open the folder containing captured photos by default-Gallery in Android .
But after opening it, it shows "cannot be load" at the screen of the Gallery.
Would you please tell me is there amything missing to pass the intent ?
The below is my code
public void buttonGallery(View v) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(resultPhoto.getAbsolutePath()), "image/*");
startActivity(intent);
}
...
File mediaStorageDir = new File(Environment.getExternalStorageDirectory() + File.separator + "NBA_FINAL_photo");
resultPhoto = mediaStorageDir;
Upvotes: 2
Views: 2646
Reputation: 6193
you have to add "file://" into Uri
intent.setDataAndType(Uri.parse("file://" + resultPhoto.getAbsolutePath(), "image/*");
Upvotes: 0
Reputation: 80
I think you forget set Permisson in manifest.xml
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
Upvotes: 1