Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import java.io.File;

public class Main {
    public static File getFeedbackStorageDirectory(Context context) {
        File feedbackStorageDirectory = null;

        feedbackStorageDirectory = new File(Environment.getExternalStorageDirectory(), context.getPackageName());

        // Create the storage directory if it does not exist
        if (!feedbackStorageDirectory.exists()) {
            if (!feedbackStorageDirectory.mkdirs()) {
                System.out.print("failed to create directory");
                return null;
            }
        }
        return feedbackStorageDirectory;
    }
}