Example usage for android.os Environment MEDIA_MOUNTED

List of usage examples for android.os Environment MEDIA_MOUNTED

Introduction

In this page you can find the example usage for android.os Environment MEDIA_MOUNTED.

Prototype

String MEDIA_MOUNTED

To view the source code for android.os Environment MEDIA_MOUNTED.

Click Source Link

Document

Storage state if the media is present and mounted at its mount point with read/write access.

Usage

From source file:Main.java

public static boolean isHasSdcard() {
    String status = Environment.getExternalStorageState();
    return status.equals(Environment.MEDIA_MOUNTED);
}

From source file:Main.java

public static boolean isSDCardMounted() {
    String state = Environment.getExternalStorageState();
    return state.equals(Environment.MEDIA_MOUNTED);
}

From source file:Main.java

public static boolean hasSdcard() {
    String state = Environment.getExternalStorageState();
    if (state.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    } else {// ww w . j a  v a 2s  .co m
        return false;
    }
}

From source file:Main.java

public static boolean isHasSDCard() {
    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED))
        return true;
    else/* w  w  w. j  av  a  2 s  .  c  om*/
        return false;
}

From source file:Main.java

public static long getSDTotalSize() {
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        return getTotalSize(Environment.getExternalStorageDirectory().toString());
    }/* w  ww.j  a v  a 2s  .  c  o  m*/

    return 0;
}

From source file:Main.java

public static String getExternalPath() {

    String ext = Environment.getExternalStorageState();
    if (ext.equals(Environment.MEDIA_MOUNTED)) {
        return Environment.getExternalStorageDirectory().getAbsolutePath();
    } else {//from w  ww  . j ava  2s  . co  m
        return null;
    }
}

From source file:Main.java

public static boolean IsSDCARDMounted() {
    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED))
        return true;
    return false;
}

From source file:Main.java

public static boolean hasSdcard() {
    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    } else {/* w  w w  . jav a  2s .  c o  m*/
        return false;
    }
}

From source file:Main.java

public static void deleteFile(File file) {
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        if (file.exists()) {
            if (file.isFile()) {
                file.delete();/*  www .  j  av a2  s. c  om*/
            }

            file.delete();
        }
    }
}

From source file:Main.java

public static boolean checkExternalStorageAvailable() {
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
        return true;
    } else {/*from  w  ww  .ja v a2  s  . c  o m*/
        return false;
    }
}