Example usage for android.os Environment isExternalStorageRemovable

List of usage examples for android.os Environment isExternalStorageRemovable

Introduction

In this page you can find the example usage for android.os Environment isExternalStorageRemovable.

Prototype

public static boolean isExternalStorageRemovable() 

Source Link

Document

Returns whether the primary shared/external storage media is physically removable.

Usage

From source file:com.andreaszeiser.bob.ImageCache.java

/**
 * Check if external storage is built-in or removable.
 * //from   ww w  .  ja  v  a  2s .  com
 * @return True if external storage is removable (like an SD card), false
 *         otherwise.
 */
@TargetApi(9)
public static boolean isExternalStorageRemovable() {
    if (UIUtils.hasGingerbread()) {
        return Environment.isExternalStorageRemovable();
    }
    return true;
}

From source file:com.xiaodong.dream.catcher.demo.image.ImageCache.java

/**
 * Check if external storage is built-in or removable.
 *
 * @return True if external storage is removable (like an SD card), false
 *         otherwise./*from  w w w . j  av a 2s. c  o m*/
 */
@TargetApi(9)
public static boolean isExternalStorageRemovable() {
    if (ImageUtils.hasGingerbread()) {
        return Environment.isExternalStorageRemovable();
    }
    return true;
}

From source file:com.wowcow.chat10.imagecache.ImageCache.java

/**
 * Check if external storage is built-in or removable.
 * /*from  w ww  . ja v a  2s .  co m*/
 * @return True if external storage is removable (like an SD card), false
 *         otherwise.
 */
@TargetApi(9)
public static boolean isExternalStorageRemovable() {
    if (VersionUtil.hasGingerbread()) {
        return Environment.isExternalStorageRemovable();
    }
    return true;
}

From source file:com.fireplace.market.fads.util.ImageCache.java

/**
 * Check if external storage is built-in or removable.
 * //from w  w  w  .ja  v  a  2 s . c o m
 * @return True if external storage is removable (like an SD card), false
 *         otherwise.
 */
@TargetApi(9)
public static boolean isExternalStorageRemovable() {
    if (Fireplace.IS_GINGERBREAD) {
        return Environment.isExternalStorageRemovable();
    }
    return true;
}

From source file:com.haipeng.libraryforandroid.cacheormemory.imageload.ImageCache.java

/**
 * Check if external storage is built-in or removable.
 *
 * @return True if external storage is removable (like an SD card), false
 *         otherwise./* ww  w . j  a v  a 2s  .co m*/
 */
@TargetApi(9)
public static boolean isExternalStorageRemovable() {
    if (SDKVersionUtil.hasGingerbread()) {
        return Environment.isExternalStorageRemovable();
    }
    return true;
}

From source file:com.colorchen.qbase.utils.FileUtil.java

/**
 * ?// w w w  .j  av  a  2  s  . c o m
 *
 * @param context
 * @return
 */
public static String getDiskCacheDir(Context context) {
    String cachePath = null;
    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
            || !Environment.isExternalStorageRemovable()) {
        cachePath = context.getExternalCacheDir().getPath();
    } else {
        cachePath = context.getCacheDir().getPath();
    }
    return cachePath;
}

From source file:com.android.volley.plus.ImageCache.java

/**
 * Check if external storage is built-in or removable.
 *
 * @return True if external storage is removable (like an SD card), false
 *         otherwise./* w  w  w.j  av  a 2 s  .  c o  m*/
 */
//    @TargetApi(9)
public static boolean isExternalStorageRemovable() {
    return !OsVersionUtils.hasGingerbread() || Environment.isExternalStorageRemovable();
}

From source file:com.colorchen.qbase.utils.FileUtil.java

/**
 * ?//ww  w .j  a va2s  . c  o m
 *
 * @param context
 * @return
 */
public static String getDiskFileDir(Context context) {
    String cachePath = null;
    if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
            || !Environment.isExternalStorageRemovable()) {
        cachePath = context.getExternalFilesDir(Environment.DIRECTORY_MOVIES).getPath();
    } else {
        cachePath = context.getFilesDir().getPath();
    }
    return cachePath;
}

From source file:com.apptentive.android.sdk.util.Util.java

public static File getDiskCacheDir(Context context) {
    File appCacheDir = null;/* w  w  w. j a  v  a 2 s.com*/
    if ((Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())
            || !Environment.isExternalStorageRemovable())
            && hasPermission(context, "android.permission.WRITE_EXTERNAL_STORAGE")) {
        appCacheDir = context.getExternalCacheDir();
    }

    if (appCacheDir == null && context != null) {
        appCacheDir = context.getCacheDir();
    }
    return appCacheDir;
}

From source file:com.andrew.apollo.cache.ImageCache.java

/**
 * Check if external storage is built-in or removable
 * // ww  w  .j  a va 2 s .  c  om
 * @return True if external storage is removable (like an SD card), false
 *         otherwise
 */
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public static final boolean isExternalStorageRemovable() {
    if (ApolloUtils.hasGingerbread()) {
        return Environment.isExternalStorageRemovable();
    }
    return true;
}