工具类
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;
}
网友评论