List of usage examples for android.os Environment isExternalStorageRemovable
public static boolean isExternalStorageRemovable()
From source file:Main.java
public static boolean exterStorageReady() { return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable(); }
From source file:Main.java
public static boolean isExternalSDStorage() { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state) && Environment.isExternalStorageRemovable()) { return true; }/* w w w. j a v a 2s .com*/ return false; }
From source file:Main.java
private static boolean isExternalStorageRemovable() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return Environment.isExternalStorageRemovable(); }/* w w w .j a v a 2s . c om*/ return true; }
From source file:Main.java
public static String getCacheDir(Context ctx) { return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable() ? ctx.getExternalCacheDir().getPath() : ctx.getCacheDir().getPath(); }
From source file:Main.java
public static File getDiskCacheDir(Context context) { if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) { return context.getExternalCacheDir(); } else {// ww w . j a v a 2 s. c om return context.getCacheDir(); } }
From source file:Main.java
public static File getDiskDir(String uniqueName) { if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) { File storageDirectory = Environment.getExternalStorageDirectory(); if (storageDirectory != null) { File file = new File(storageDirectory + File.separator + uniqueName); if (!file.exists() && !file.isDirectory()) { file.mkdir();//w ww . j a v a 2s .co m } return file; } } return null; }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.GINGERBREAD) public static boolean isExternalStorageRemovable() { return Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD || Environment.isExternalStorageRemovable(); }
From source file:Main.java
public static String getDiskCacheDir(Context context) { String cachePath = null;/*from ww w . j av a 2 s . c om*/ if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) && !Environment.isExternalStorageRemovable() && context.getExternalCacheDir() != null) { cachePath = context.getExternalCacheDir().getPath(); } else { cachePath = context.getCacheDir().getPath(); } return cachePath; }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.GINGERBREAD) public static boolean isExternalStorageRemovable() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { return Environment.isExternalStorageRemovable(); }//from ww w .j av a 2 s .c om return true; }
From source file:Main.java
public static String getCachePath(Context context, String uniqueName) { String cachePath;//from w w w . j a v a2 s. co m if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()) || !Environment.isExternalStorageRemovable()) { cachePath = context.getExternalCacheDir().getPath(); } else { cachePath = context.getCacheDir().getPath(); } return cachePath + File.separator + uniqueName; }