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 isSDCardAvailable(Context mContext) {
    return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);

}

From source file:Main.java

public static boolean isExtStorgAvailable() {
    boolean result = false;

    if (Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) {
        result = true;//from  ww  w  . j a  v  a  2 s . c  om
    }

    return result;
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static boolean checkSDCard() {
    String flag = Environment.getExternalStorageState();
    if (Environment.MEDIA_MOUNTED.equals(flag)) {
        return true;
    }/*  ww w . ja  v  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 checkSDCard() {
    String flag = Environment.getExternalStorageState();
    return Environment.MEDIA_MOUNTED.equals(flag);
}

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 .  j  a  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 w  w w. j a  v  a  2 s.co m*/
    return context.getFilesDir().toString();
}

From source file:Main.java

public static String getDiskCacheDir(Context context, String dirName) {
    final String cachePath = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
            ? context.getExternalCacheDir().getPath()
            : context.getCacheDir().getPath();

    return cachePath + File.separator + dirName;
}