1

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.

dmkrush
  • 31
  • 5

2 Answers2

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.

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