Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import android.os.Environment;

import android.util.Log;

public class Main {
    private static final String tag = "ActivityHelper";

    public static String createTbutlerFolder() {
        String folder = "/sdcard/tbutler";
        if (checkState()) {
            try {
                File file = new File(folder);
                if (!file.exists()) {
                    file.mkdir();
                }
            } catch (Exception er) {
                Log.e(tag, "error creating folder", er);
            }
        }
        return folder + "/";
    }

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