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.*;

public class Main {
    public static final String SD_CARD_PATH = Environment.getExternalStorageDirectory().toString();

    public static void deleteFiles(String relativePath) {
        //      File dir = new File(path);
        File dir = creatSDDir(relativePath);
        if (dir.isDirectory()) {
            File[] files = dir.listFiles();
            for (File file : files) {
                file.delete();
            }
        }
    }

    public static File creatSDDir(String dirRelativePath) {
        File dir = new File(SD_CARD_PATH + dirRelativePath);
        dir.mkdirs();
        return dir;
    }
}