Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: GNU General Public License 

import java.io.File;

import android.content.Context;
import android.os.Environment;

public class Main {
    public static File getCpoFilesDir(Context appCtx) {

        File filesDir;

        if (isExternalStorageWritable()) {
            // We can read and write the media
            filesDir = appCtx.getExternalFilesDir(null);
        } else {
            // Load another directory, probably local memory
            filesDir = appCtx.getFilesDir();
        }

        return filesDir;
    }

    public static boolean isExternalStorageWritable() {
        String state = Environment.getExternalStorageState();
        if (Environment.MEDIA_MOUNTED.equals(state)) {
            return true;
        }
        return false;
    }
}