My requirement is to open all images and video's of specific folder. I have refereed this link, Now I am able to show a image in gallery but I want to show all images from a specific folder. Almost all link I have tried on stack but did not get success.
Asked
Active
Viewed 1,315 times
2 Answers
1
You can set path in File object initialize at that time. File folder = new File("/sdcard/Photo/"); in this tutorial default path is /sdcard/photo/ at this place you can set your path then get your files.
-
I have already made this changes in code but did not get success. – dmkrush May 29 '15 at 08:49
-
you can specify path that path available or not?? – May 29 '15 at 08:58
-
please check exception and find the solution – May 29 '15 at 08:58
-
Now I am able to show a single photo that means I am not get any error or exception but I want to show multiple photo that should swipe right and left. – dmkrush May 29 '15 at 09:26
0
I sinc it is not good idea but you may write your own searcher in all files on mobile phone for example
public ArrayList<File> getAllphotos(String path){
ArrayList<File> photoPath = new ArrayList<>();
File yourDir = new File(path);
for (File f : yourDir.listFiles()) {
String mas[] = f.toString().split("\\.");
if(mas[mas.length - 1].equalsIgnoreCase("png") || mas[mas.length - 1].equalsIgnoreCase("jpeg")){//or other formats
//it is picture
photoPath.add(f);
}
}
return photoPath;
}
call this wis iternal and external storage

Iatsenko Anton
- 157
- 1
- 6