Environment中涉及到外部存储路径和储存大小API(测试机:魅族MX2,用其他测试机测试结果会有不同):
System.out.println("getExternalStorageDirect
ory.getAbsolutePath===="+Environment.getExternalStorageDirect
ory().getAbsolutePath());//
/mnt/sdcard
System.out.println("getExternalStorageDirect
ory.getPath===="+Environment.getExternalStorageDirect
ory().getPath());//
/mnt/sdcard
System.out.println("getExternalStorageDirect
ory.getName===="+Environment.getExternalStorageDirect
ory().getName());//
sdcard
System.out.println("getExternalStorageDirect
ory.getParent===="+Environment.getExternalStorageDirect
ory().getParent());//
/mnt
System.out.println("getExternalStorageDirect
ory.getFreeSpace===="+Environment.getExternalStorageDirect
ory().getFreeSpace()); //
12124454912
System.out.println("getExternalStorageDirect
ory.getTotalSpace===="+Environment.getExternalStorageDirect
ory().getTotalSpace());//
12624855040
System.out.println("getExternalStorageDirect
ory.getUsableSpace===="+Environment.getExternalStorageDirect
ory().getUsableSpace());//
12124454912
System.out.println("getExternalStorageState===="+Environment.getExternalStorageState());//
mounted
System.out.println("getDataDirectory.getAbsolutePath===="+Environment.getDataDirectory().getAbsolutePath());//
/data
System.out.println("getDataDirectory.getPath===="+Environment.getDataDirectory().getPath()); //
/data
System.out.println("getDataDirectory.getName===="+Environment.getDataDirectory().getName());//
data
System.out.println("getDataDirectory.getParent===="+Environment.getDataDirectory().getParent());//
/
System.out.println("getDataDirectory.getFreeSpace===="+Environment.getDataDirectory().getFreeSpace());//
1912451072
System.out.println("getDataDirectory.getTotalSpace===="+Environment.getDataDirectory().getTotalSpace());//
2113748992
System.out.println("getDataDirectory.getUsableSpace===="+Environment.getDataDirectory().getUsableSpace());//
1912451072
System.out.println("getDownloadCacheDirector
y.getAbsolutePath===="+Environment.getDownloadCacheDirector
y().getAbsolutePath());//
/cache
System.out.println("getDownloadCacheDirector
y.getPath===="+Environment.getDownloadCacheDirector
y().getPath());//
/cache
System.out.println("getDownloadCacheDirector
y.getName===="+Environment.getDownloadCacheDirector
y().getName());//
cache
System.out.println("getDownloadCacheDirector
y.getParent===="+Environment.getDownloadCacheDirector
y().getParent());//
/
System.out.println("getDownloadCacheDirector
y.getFreeSpace===="+Environment.getDownloadCacheDirector
y().getFreeSpace());//
201908224
System.out.println("getDownloadCacheDirector
y.getTotalSpace===="+Environment.getDownloadCacheDirector
y().getTotalSpace());//
206405632
System.out.println("getDownloadCacheDirector
y.getUsableSpace===="+Environment.getDownloadCacheDirector
y().getUsableSpace());//
201908224
注意:涉及到大小的API sdk必须到大于9!