Android examples for App:Cache
get disk cache directory
//package com.java2s; import java.io.File; import android.content.Context; import android.os.Environment; public class Main { /**/*from w w w. j a v a 2 s. c o m*/ * get disk cache directory * @param context * @param uniqueName * For example?bitmap for picture music for mp3 txt .. * @return */ public static String getDiskCacheDir(Context context, String uniqueName) { String cachePath = null; if (Environment.MEDIA_MOUNTED.equals(Environment .getExternalStorageState()) || !Environment.isExternalStorageRemovable()) { cachePath = Environment.getExternalStorageDirectory().getPath() + "/Android/data/" + context.getPackageName() + File.separator + "cache/" + uniqueName; } else { cachePath = context.getCacheDir().getPath(); } return cachePath; } }