I want to realize an image gallery. In main view I want to view the image folder list. On click on grid item should open the grid with images of relative folder
Asked
Active
Viewed 1,227 times
1 Answers
0
Here is some code, I hope it can be useful:
// Get directory where camera images are stored
String state = Environment.getExternalStorageState();
File imageDir = null;
if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
File externalDir = Environment.getExternalStorageDirectory();
imageDir = new File(externalDir, "DCIM/camera");
if (!imageDir.exists())
/* Handle error */;
}
// List filenames of images
String[] fileNames = imageDir.list();

Giorgio Barchiesi
- 6,109
- 3
- 32
- 36