Retrieve images of particular folder in Android

后端 未结 4 1403
一个人的身影
一个人的身影 2020-12-17 03:40

In my application I created the GridView to show the image from particular folder. The issue is that I want to retrieve images from the DCIM/100ANDRO folder. Wh

4条回答
  •  旧时难觅i
    2020-12-17 04:12

    File folder = new File(Environment.getExternalStorageDirectory().toString() + "/Folder Name/");
    folder.mkdirs();
    File[] allFiles = folder.listFiles(new FilenameFilter() {
        public boolean accept(File dir, String name) {
            return (name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".png"));
        }
    });
    

提交回复
热议问题