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;

public class Main {
    private static String sdState = Environment.getExternalStorageState();

    public static boolean deleteFile(File file) {
        if (sdState.equals(Environment.MEDIA_MOUNTED)) {
            if (file.exists()) {
                if (file.isFile()) {
                    return file.delete();
                }
            } else {
                return true; // file not exist
            }
        }
        return false;
    }
}