Example usage for android.os Environment getExternalStorageState

List of usage examples for android.os Environment getExternalStorageState

Introduction

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

Prototype

public static String getExternalStorageState() 

Source Link

Document

Returns the current state of the primary shared/external storage media.

Usage

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 isExistSDcard() {
    String state = Environment.getExternalStorageState();
    if (state.equals(Environment.MEDIA_MOUNTED))
        return true;
    else {/*from w  w w  .jav  a2s.  c  o m*/
        return false;
    }
}

From source file:Main.java

public static String getSDPath() {
    boolean hasSDCard = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    if (hasSDCard) {
        return Environment.getExternalStorageDirectory().toString() + "/mvpDemo";
    } else {/*w  ww . j  a v  a2  s .  c o m*/
        return null;
    }
}

From source file:Main.java

public static String getExternalPath() {

    String ext = Environment.getExternalStorageState();
    if (ext.equals(Environment.MEDIA_MOUNTED)) {
        return Environment.getExternalStorageDirectory().getAbsolutePath();
    } else {/* w  ww .  ja v  a2 s .c om*/
        return null;
    }
}

From source file:Main.java

public static boolean externalMounted() {
    String state = Environment.getExternalStorageState();
    if (state.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    }//from www  . j a  v  a  2s.com
    return false;
}

From source file:Main.java

public static boolean checkSDCARD() {

    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    }/*  w w  w. jav  a2  s .  c  o  m*/
    return false;
}

From source file:Main.java

public static boolean isMountSdCard() {
    String mountState = Environment.getExternalStorageState();
    if (mountState.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    }/* w ww .  j  a  v  a2  s .  co m*/
    return false;
}

From source file:Main.java

private static boolean isExternalStorageReadable() {
    String state = Environment.getExternalStorageState();
    return Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state);
}

From source file:Main.java

public static final boolean hasSDCard() {
    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    } else {/* w  w w.  j  av  a2s .c o m*/
        return false;
    }
}

From source file:Main.java

public static boolean isSdCardWriteable() {
    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    }//from  w w w.ja v a2  s .c om
    return false;
}