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 hasSdcard() {
    String status = Environment.getExternalStorageState();
    if (status.equals(Environment.MEDIA_MOUNTED))
        return true;
    else//from  w w w .j  a va2s .  c  o  m
        return false;
}

From source file:Main.java

public static boolean GetSdCardFile() {
    String str = Environment.getExternalStorageState();
    return (!IsEmpty(str)) && ((str.equals("mounted")) || (str.equals("mounted_ro")))
            && (Environment.getExternalStorageDirectory() != null);
}

From source file:Main.java

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

From source file:Main.java

public static boolean isExternalMediaMounted() {
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        return true;
    }/*w  ww.ja  v a 2  s .c om*/

    return false;
}

From source file:Main.java

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

From source file:Main.java

public static boolean checkSDCard() {
    String flag = Environment.getExternalStorageState();
    if (android.os.Environment.MEDIA_MOUNTED.equals(flag)) {
        return true;
    }// www  .  j a  v a  2 s .  c o 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 ww .  j av a2  s.com
        return false;
}

From source file:Main.java

public static boolean hasSdcard() {
    String state = Environment.getExternalStorageState();
    if (state.equals(Environment.MEDIA_MOUNTED)) {
        return true;
    } else {/*from w  w w.  j a v a  2  s.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();
    } else/* w  w  w  . j  a v  a  2 s  . com*/
        return Environment.getDownloadCacheDirectory().toString();
}

From source file:Main.java

public static boolean hasSDCard() {
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state)) {
        return true;
    } else {/*  w  ww .  j  ava 2  s .c  om*/
        return false;
    }
}