每次都会忘记还是记下来吧!!
手机缓存目录:
通过context.getCacheDir()可以获得,/data/data/packagename/cache。
SD卡缓存目录:
// android 2.2 以后才支持的特性
if (hasExternalCacheDir()) {
return context.getExternalCacheDir().getPath() + File.separator
+ "img";
}
// Before Froyo we need to construct the external cache dir ourselves
// 2.2以前我们需要自己构造
final String cacheDir = "/Android/data/" + context.getPackageName()
+ "/cache";