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 isSdCard() {
    boolean sdCardExist = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    if (sdCardExist) {
        return true;
    } else {/*w  w w .  j  a va2s . com*/
        return false;
    }
}

From source file:Main.java

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

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 .  java 2s.co  m
    }
    return nRet;
}

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 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 isCanUseSD() {
    try {//from w  w w  . java2 s . c o  m
        return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
    } catch (Exception e) {
        e.printStackTrace();
    }

    return false;
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static boolean existExternalStorageDirectory() {
    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
            && Environment.getExternalStorageDirectory().canWrite()) {

        return true;
    }// ww  w  . jav a 2  s . c o m

    return false;
}

From source file:Main.java

public static boolean SDExist() {
    boolean ret = false;
    if (Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) {
        ret = true;// w  w  w.j a v  a2s  . com
    }
    return ret;
}