Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.os.Environment;

import java.io.File;

public class Main {
    public static final String STORAGE_PATH = Environment.getExternalStorageDirectory() + "/DCIM/MyCamera/";

    public static File[] getFiles() {
        File fileDir = getFilesDirectory(STORAGE_PATH);
        if (!fileDir.exists()) {
            if (!fileDir.mkdirs()) {
                return null;
            }
        }
        return fileDir.listFiles();
    }

    public static File getFilesDirectory(String storage_path) {
        storage_path = STORAGE_PATH;
        File filesDirectory = new File(storage_path);
        return filesDirectory;
    }
}