List of usage examples for android.os Environment getExternalStorageState
public static String getExternalStorageState()
From source file:Main.java
public static boolean isExtStorgAvailable() { boolean result = false; if (Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) { result = true;/*from w w w.j av a 2 s . c o m*/ } return result; }
From source file:Main.java
/** * is has sd//w ww . j a v a 2 s. c o m * @return */ public static boolean isSDCard() { return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); }
From source file:Main.java
public static boolean isExternalStorageReadOnly() { String extStorageState = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(extStorageState)) { return true; }//from w w w. j a v a 2 s. c o m return false; }
From source file:Main.java
public static boolean getSDCardStatus() { return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); }
From source file:Main.java
public static long getSdCardFree() { long l = 0L;// www . ja va 2s . com if (Environment.getExternalStorageState().equals("mounted")) { StatFs statfs = new StatFs(Environment.getExternalStorageDirectory().getPath()); l = ((long) statfs.getBlockSize() * (long) statfs.getAvailableBlocks()) / 1024L / 1024L; } return l; }
From source file:Main.java
public static boolean hasSDCard() { String status = Environment.getExternalStorageState(); return status.equals(Environment.MEDIA_MOUNTED); }
From source file:Main.java
public static boolean isSDCardWritable() { if (isSDCardExist()) { return !Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED_READ_ONLY); }//from w w w . j av a 2 s . co m return false; }
From source file:Main.java
public static boolean hasSdcard() { String state = Environment.getExternalStorageState(); return state.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 File getDataRoot() { try {//w w w .j av a2 s .c om if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED) || (Environment.getExternalStorageDirectory().exists() && Environment.getExternalStorageDirectory().canWrite())) { return Environment.getExternalStorageDirectory(); } else { return Environment.getDataDirectory(); } } catch (Exception e) { return null; } }