其中在外部儲存快取時部分機型會獨佔儲存裝置導致應用崩潰。
dir = this.getexternalcachedir().getabsolutepath();
log.i("列印cache", dir);
dir = this.getfilesdir().getpath();
log.i("列印filesdir", dir);
dir = environment.media_mounted;
log.i("列印filesdir", dir);
dir = environment.getexternalstoragestate();
log.i("列印enviroment state", dir);
dir = environment.getrootdirectory().getabsolutepath();
log.i("列印enviroment root", dir);
dir = getcachedir().getpath();
log.i("列印 inner cache", dir);
string cachepath = environment.media_mounted.equals(environment
.getexternalstoragestate()) || !environment.i***ternalstorageremovable() ? getexternalcachedir()
.getpath() : getcachedir().getpath();
log.i("列印 external", cachepath);
08-19 16:05:12.296 17190-17190/com.antwei.mychat i/列印cache﹕ /storage/emulated/0/android/data/com.antwei.mychat/cache
08-19 16:05:12.657 17190-17190/com.antwei.mychat i/列印filesdir﹕ /data/data/com.antwei.mychat/files
08-19 16:05:12.657 17190-17190/com.antwei.mychat i/列印filesdir﹕ mounted
08-19 16:05:12.657 17190-17190/com.antwei.mychat i/列印enviroment state﹕ mounted
08-19 16:05:12.657 17190-17190/com.antwei.mychat i/列印enviroment root﹕ /system
08-19 16:05:12.657 17190-17190/com.antwei.mychat i/列印 inner cache﹕ /data/data/com.antwei.mychat/cache
08-19 16:05:12.657 17190-17190/com.antwei.mychat i/列印 external﹕ /storage/emulated/0/android/data/com.antwei.mychat/cache
Android app的檔案快取目錄
data data packagename files 檔案快取目錄,一般存小的檔案快取,如果是,不建議放這裡,一般放到外接卡。file file getfilesdir 返回該目錄 寫檔案到該目錄下可以像這樣 fileoutputstream fos null try catch exceptio...
Android APP中清除快取功能詳解
快取資料的統計分2塊 記憶體 這裡指的是應用程式包目錄所在位置 外存 外部儲存卡 清除的目錄包括 1.data data package name files 2.data data package name cache 3.android data cache 4.webview快取資料 計算快取...
計算Android app快取大小以及清除快取
這是乙個常用功能,記錄一下 才是精華 object cacheutils return getformatsize cachesize.todouble 清理全部快取 param context fun clearallcache context context 刪除檔案 param dir ret...