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 checkSDCard() {
    String flag = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(flag)) {
        return true;
    }//from   w  w  w .  j  av a 2  s. c o  m
    return false;
}

From source file:Main.java

public static boolean isSDCardAvailable(Context mContext) {
    return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);

}

From source file:Main.java

public static boolean isExternalStorageExists() {
    return Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
}

From source file:Main.java

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

From source file:Main.java

public static boolean hasSDCard() {
    boolean b = false;
    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
        b = true;/*from w  w w  . j  a va2 s . c o m*/
    }
    return b;
}

From source file:Main.java

public static boolean isExternalStorageExists() {
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        return true;
    }/*w  ww . j av a 2s .co m*/
    return false;
}

From source file:Main.java

public static boolean hasSDCardMounted() {
    String state = Environment.getExternalStorageState();
    if (state != null && state.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    } else {//from   ww  w .j av a 2  s . c o m
        return false;
    }
}

From source file:Main.java

public static Boolean isExternalStorageAvailable() {
    return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
}

From source file:Main.java

public static boolean isSDCardAvailable(final Context context) {
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        if (context.getExternalCacheDir() != null) {
            return true;
        }//from   ww w.  ja v a2  s . c  o  m
    }
    return false;
}

From source file:Main.java

public static String getSavePath(Context context) {
    boolean hasSDCard = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    if (hasSDCard) {
        return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString();
    }/*from ww  w. j a  v a  2  s .  co m*/
    return context.getFilesDir().toString();
}