标签:absolute style int ddr sd卡 address sys mis systems
public static void getFileName(File[] files) { String address=""; if (files != null)// 先判断目录是否为空,否则会报空指针 { for (File file : files) { if (file.isDirectory()) { getFileName(file.listFiles()); } else { String fileName = file.getName(); address=file.getAbsolutePath(); // HashMap map = new HashMap(); System.out.println("***address:"+address); System.out.println("***name:"+fileName); } } } }
// 获得SD卡路径
File file1=new File(Environment.getExternalStorageDirectory()+File.separator+"AA"); File[] files = file1.listFiles();// 读取 Utils.getFileName(files);
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
标签:absolute style int ddr sd卡 address sys mis systems
原文地址:http://www.cnblogs.com/galibujianbusana/p/6129370.html