计算缓存大小,写在onCreate()里: final File fileDie=MainActivity.this.getFilesDir(); try { //计算缓存大小 DIRsize= DataCleanManager.getCacheSize(fileDie); //设置缓存空间大小 sdql.setText("缓存大小:"+DIRsize); } catch (Exception e) { e.printStackTrace(); } 写在点击监听事件里: DataCleanManager.cleanApplicationData(MainActivity.this,fileDie.getAbsolutePath()); Toast.makeText(MainActivity.this, "已清理!", Toast.LENGTH_SHORT).show(); try { DIRsize= DataCleanManager.getCacheSize(fileDie); sdql.setText("缓存大小:"+DIRsize); } catch (Exception e) { e.printStackTrace(); } 还要新建一个类,网址:http://blog.csdn.net/wwj_748/article/details/42737607
清除缓存
最新推荐文章于 2020-04-01 11:17:13 发布