可以获得文件夹中所有文件的路径及文件名。
代码很简单,直接上车,车上再解释:
/**
* 获取指定目录内所有文件路径
* @param dirPath 需要查询的文件目录
* @param _type 查询类型,比如mp3什么的
*/
public static JSONArray getAllFiles(String dirPath, String _type) {
File f = new File(dirPath);
if (!f.exists()) {//判断路径是否存在
return null;
}
File