Android开发中缓存的清理
2018-03-25 本文已影响0人
opkcloud
工具类
cleanCache= view.findViewById(R.id.clean_cache);
this.cleanCache.setOnClickListener(this);
try {
cleanCache.setText(CacheUtil.getTotalCacheSize(getContext()));
}catch (Exception e) {
e.printStackTrace();
}
switch (v.getId()) {
case R.id.clean_cache :
CacheUtil.clearAllCache(getContext());
Toast.makeText(getContext(),"缓存已清理",Toast.LENGTH_SHORT).show();
cleanCache.setText("ok");
break;
}