Android开发中缓存的清理

工具类


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;

}

你可能感兴趣的:(Android开发中缓存的清理)