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 isSdcardExist() {
    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    } else {/*from   ww  w .ja  va 2 s.co  m*/
        return false;
    }
}

From source file:Main.java

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

From source file:Main.java

public static boolean sdCardIsAvailable() {
    String status = Environment.getExternalStorageState();
    if (!status.equals(Environment.MEDIA_MOUNTED))
        return false;
    return true;/*  w ww .j  av a  2  s .  c o  m*/
}

From source file:Main.java

public static boolean isExternalSDStorage() {
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state) && Environment.isExternalStorageRemovable()) {
        return true;
    }/*from  w  ww  .j  a va2 s. c o m*/
    return false;
}

From source file:Main.java

public static boolean isSdCard() {
    boolean sdCardExist = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    if (sdCardExist) {
        return true;
    } else {//from   ww w  . j a v a 2 s  .  c  o  m
        return false;
    }
}

From source file:Main.java

public static boolean sdcardMounted() {
    final String state = Environment.getExternalStorageState();
    if (state.equals(Environment.MEDIA_MOUNTED) && !state.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) {
        return true;
    }//from  w  ww .ja v a  2s. co m
    return false;
}

From source file:Main.java

public static boolean sdCardIsAvailable() {
    String status = Environment.getExternalStorageState();
    if (!status.equals(Environment.MEDIA_MOUNTED)) {
        return false;
    }/*from  ww w. j  a  v  a 2s.  c om*/
    return true;
}

From source file:Main.java

public static int isSDCardExist() {
    int nRet = 0;
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        nRet = 1;/*from w w  w . jav  a2  s.  c  o m*/
    }
    return nRet;
}

From source file:Main.java

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

From source file:Main.java

public static boolean checkSDCardStatus() {
    String sdcardStatus = Environment.getExternalStorageState();
    return sdcardStatus.equals(android.os.Environment.MEDIA_MOUNTED);
}