@OnClick(R.id.getAll) public void getAll(View view) { List<CacheEntity<Object>> all = CacheManager.INSTANCE.getAll(); StringBuilder sb = new StringBuilder(); sb.append("共" + all.size() + "条缓存:").append("\n\n"); for (int i = 0; i < all.size(); i++) { CacheEntity<Object> cacheEntity = all.get(i); sb.append("第" + (i + 1) + "条缓存:").append("\n").append(cacheEntity).append("\n\n"); } AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("所有缓存显示").setMessage(sb.toString()).show(); }
@OnClick(R.id.clear) public void clear(View view) { boolean clear = CacheManager.INSTANCE.clear(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("清除缓存").setMessage("是否清除成功:" + clear).show(); }