What is a good way to get a list of files from (a directory on) the sd card?

前端 未结 3 956
悲哀的现实
悲哀的现实 2020-12-10 06:41

I\'m happy reading and writing to a pre-set file, and could manually populate a listview, but I\'m hoping there is an official(or not) filebrowser I missed, or other more el

3条回答
  •  情歌与酒
    2020-12-10 07:23

    File fileList = new File("/sdcard");
    if (fileList != null){
        File[] filenames = fileList.listFiles();
            for (File tmpf : filenames){
                //Do something with the files
            }
        }
    }
    

    Is another method you can try

提交回复
热议问题