List of usage examples for android.os Environment MEDIA_MOUNTED
String MEDIA_MOUNTED
To view the source code for android.os Environment MEDIA_MOUNTED.
Click Source Link
From source file:com.bukanir.android.utils.Utils.java
public static boolean isStorageAvailable() { return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()); }
From source file:com.phonegap.DirectoryManager.java
/** * Get the free disk space on the SD card * //from w ww.ja v a 2s .c o m * @return Size in KB or -1 if not available */ protected static long getFreeDiskSpace() { String status = Environment.getExternalStorageState(); long freeSpace = 0; // If SD card exists if (status.equals(Environment.MEDIA_MOUNTED)) { try { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); freeSpace = availableBlocks * blockSize / 1024; } catch (Exception e) { e.printStackTrace(); } } // If no SD card, then return -1 else { return -1; } return (freeSpace); }
From source file:Main.java
/** * @return checks if the sdcard is mounted *//*from ww w . j a va 2 s. c o m*/ public static boolean isSDCardMounted() { return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); }
From source file:my.extensions.app.AudioFileLister.java
private boolean musicDirectoryReadable() { String state = Environment.getExternalStorageState(); return Environment.MEDIA_MOUNTED_READ_ONLY.equals(state) || Environment.MEDIA_MOUNTED.equals(state); }
From source file:MainActivity.java
public boolean isExternalStorageReadable() { if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || Environment.MEDIA_MOUNTED_READ_ONLY.equals(Environment.getExternalStorageState())) { return true; }//from w w w.ja va 2 s .c o m return false; }
From source file:Main.java
public static boolean isExternalStorageWritable() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { return true; }/*from w w w.j a v a 2s. com*/ return false; }
From source file:Main.java
/** * Checks if external storage is available for read and write. * // w w w . jav a 2s .co m * @return True-If the external storage is writable. */ private static boolean isExternalStorageWritable() { return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()); }
From source file:Main.java
public static boolean isSDCARDMounted() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { mExternalStorageAvailable = mExternalStorageWritable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { mExternalStorageAvailable = true; mExternalStorageWritable = false; } else {// w w w .j a v a 2 s. c om mExternalStorageAvailable = mExternalStorageWritable = false; } return mExternalStorageAvailable && mExternalStorageWritable; }
From source file:com.cyberocw.habittodosecretary.file.StorageHelper.java
public static boolean checkStorage() { boolean mExternalStorageAvailable; boolean mExternalStorageWriteable; String state = Environment.getExternalStorageState(); switch (state) { case Environment.MEDIA_MOUNTED: // We can read and write the media mExternalStorageAvailable = mExternalStorageWriteable = true; break;/*from www . j a v a2 s .c o m*/ case Environment.MEDIA_MOUNTED_READ_ONLY: // We can only read the media mExternalStorageAvailable = true; mExternalStorageWriteable = false; break; default: // Something else is wrong. It may be one of many other states, but // all we need // to know is we can neither read nor write mExternalStorageAvailable = mExternalStorageWriteable = false; break; } return mExternalStorageAvailable && mExternalStorageWriteable; }
From source file:it.feio.android.omninotes.utils.StorageManager.java
public static boolean checkStorage() { boolean mExternalStorageAvailable = false; boolean mExternalStorageWriteable = false; String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { // We can read and write the media mExternalStorageAvailable = mExternalStorageWriteable = true; } else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) { // We can only read the media mExternalStorageAvailable = true; mExternalStorageWriteable = false; } else {//from www . j ava2 s . c om // Something else is wrong. It may be one of many other states, but // all we need // to know is we can neither read nor write mExternalStorageAvailable = mExternalStorageWriteable = false; } return mExternalStorageAvailable && mExternalStorageWriteable; }