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 String getSdcardDir() {
    if (Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) {
        return Environment.getExternalStorageDirectory().toString();
    }/*from w  w  w. j  a va  2s .  c o m*/
    return null;
}

From source file:Main.java

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

From source file:Main.java

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

    return false;
}

From source file:Main.java

public static String getSdPath() {
    if (Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) {
        return Environment.getExternalStorageDirectory().toString();
    }//from   w w  w  . j  ava2  s .c  o  m
    return null;
}

From source file:Main.java

public static String getSDPath() {
    boolean hasSDCard = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    if (hasSDCard) {
        return Environment.getExternalStorageDirectory().toString();
    } else//from   w w w.ja v a  2 s.com
        return Environment.getDownloadCacheDirectory().toString();
}

From source file:Main.java

public static boolean isExternalStorageAvailable() {
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        return true;
    } else {/*from w  w  w . j av  a2  s .com*/
        return false;
    }
}

From source file:Main.java

public static boolean isSDReadable() {
    String state = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(state) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
        return true;
    }/*  ww  w.  j  a va 2 s . c om*/
    return false;
}

From source file:Main.java

public static boolean isExistSdCard() {
    boolean sdCardExist = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    return sdCardExist;
}

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 {/*from   ww  w .  ja  va2  s.  c o m*/
        return null;
    }
}

From source file:Main.java

public static boolean checkSDCard() {
    String flag = Environment.getExternalStorageState();
    if (android.os.Environment.MEDIA_MOUNTED.equals(flag)) {
        return true;
    }// w w w .  j  a v a  2 s .  c o m
    return false;
}