Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;

import java.io.File;

public class Main {

    public static File getCacheDir(Context context) {
        File result = context.getCacheDir();
        if (result == null) {
            result = context.getDir("cache", 0);
        }
        if (result == null) {
            result = new File("/data/data/" + context.getPackageName() + "/app_cache");
        }
        if (!result.exists()) {
            result.mkdirs();
        }
        return result;
    }
}