5.23学习记录

android获取文件目录 
/**
* 获得存储文件
*
* @param
* @param
* @return
*/
public static File getCacheFile(Context context, String name) {
String cachePath;
if (Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState())
|| !Environment.isExternalStorageRemovable()) {

cachePath = context.getExternalCacheDir().getPath();
} else {
cachePath = context.getCacheDir().getPath();
}
return new File(cachePath + File.separator + name);
}

}
原文地址:https://www.cnblogs.com/blog-wangke/p/14865768.html