Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import android.os.Environment;
import java.io.File;

public class Main {
    public static String pathPrefix;
    private static File storageDir = null;

    private static File generateFiePath(String var0, String var1, Context context) {
        String var3 = null;
        if (var0 == null) {
            var3 = pathPrefix + var1 + "/file/";
        } else {
            var3 = pathPrefix + var0 + "/" + var1 + "/file/";
        }

        return new File(getStorageDir(context), var3);
    }

    private static File getStorageDir(Context context) {
        if (storageDir == null) {
            File file = Environment.getExternalStorageDirectory();
            if (file.exists()) {
                return file;
            }

            storageDir = context.getFilesDir();
        }

        return storageDir;
    }
}