Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import java.io.File;

public class Main {
    private static final String DISK_CACHE_SUBDIR = "thumbnails";

    public static File getDiskCacheFile(Context context, String key) {
        final String cachePath = context.getFilesDir().getPath();
        File cacheDir = new File(cachePath + File.separator + DISK_CACHE_SUBDIR);
        if (!cacheDir.exists()) {
            cacheDir.mkdir();
        }
        return new File(cacheDir + File.separator + key);
    }
}