Android Context Get getDiskCacheDir(Context context, String uniqueName)

Here you can find the source of getDiskCacheDir(Context context, String uniqueName)

Description

get Disk Cache Dir

Declaration

public static File getDiskCacheDir(Context context, String uniqueName) 

Method Source Code

//package com.java2s;
import java.io.File;
import android.content.Context;

import android.os.Environment;

public class Main {

    public static File getDiskCacheDir(Context context, String uniqueName) {
        final String cachePath = Environment.MEDIA_MOUNTED
                .equals(Environment.getExternalStorageState()) ? getExternalCacheDir(
                context).getPath()// ww w .  ja  v a 2 s . co m
                : context.getCacheDir().getPath();

        return new File(cachePath + File.separator + uniqueName);
    }

    public static File getExternalCacheDir(Context context) {
        final String cacheDir = "/Android/data/" + context.getPackageName()
                + "/cache/";
        return new File(Environment.getExternalStorageDirectory().getPath()
                + cacheDir);
    }
}

Related

  1. getDefaultDisplayMetrics( @Nonnull Context context)
  2. getDefaultDisplayMetrics( @Nonnull Context context)
  3. getDensity(Context context)
  4. getDensity(Context context)
  5. getDensityDimen(Context context, int dimen)
  6. getDisplayMetrics(Context context)
  7. getDisplayPhoto(Context context, long photoFileId)
  8. getDpiToPix(Context ctx)
  9. getEditor( Context ctx)