Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.File;

public class Main {
    private static String T_FLASH_PATH = "/storage/sdcard1";

    public static double getTFlashCardSpaceWhenInsertSdcard() {
        File dir;
        if (getStorageDirWhenInsertSdcard() != null) {
            dir = new File(T_FLASH_PATH);
            return dir.getTotalSpace() * 0.8;
        }

        return 0;
    }

    public static File getStorageDirWhenInsertSdcard() {
        File dir;
        try {
            dir = new File(T_FLASH_PATH, getMainDirName());
        } catch (Exception e) {
            return null;
        }

        if (!dir.exists()) {
            dir.mkdirs();
        }

        return dir;
    }

    public static String getMainDirName() {
        return "/aiowner";
    }
}