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:cn.com.wo.bitmap.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  ava 2  s .  com
 */
@TargetApi(9)
public static boolean isExternalStorageRemovable() {
    if (Utils.hasGingerbread()) {
        return Environment.isExternalStorageRemovable();
    }
    return true;
}

From source file:com.lewa.crazychapter11.MainActivity.java

private void justForTest() {
    int i = 2;//from   ww  w  .j a  va 2  s  .  co  m
    int j;
    Integer wrapperri = Integer.valueOf(i);
    i = 7;
    j = wrapperri.intValue();

    Log.i("algerhe_test_int", "i=" + i + "  j=" + j + "  wrapperri=" + wrapperri);

    String testString = com.lewa.mytestservice.MyService.commononString();
    // Log.i("algerheTest","justForTest:testString="+testString);

    Log.i("algerheTest",
            "filepath: Environment.getExternalStorageDirectory()=" + Environment.getExternalStorageDirectory());
    Log.i("algerheTest", "filepath: getExternalCacheDir()=" + getExternalCacheDir(this));

    writeFile("My name is Algerhe");
    writeFileToSD("Wo De MingZi Shi Hechunhua zai sd card shang !");
    Log.i("algerheTest", "filepath: getSDPath()=" + getSDPath());
    // Log.i("algerheTest","filepath: getStoragePath(this,true)="+getStoragePath(this,true));
    // Log.i("algerheTest","filepath: getStoragePath(this,false)="+getStoragePath(this,false));

    StorageManager storageManager = (StorageManager) this.getSystemService(Context.STORAGE_SERVICE);
    String[] sdcardlist = storageManager.getVolumePaths();

    String mSDCardPath = null;
    String mSDCard2Path = null;
    mSDCardPath = sdcardlist[0];
    mSDCard2Path = sdcardlist[1];
    Log.i("algerheTest", "filepath: mSDCardPath=" + mSDCardPath);
    Log.i("algerheTest", "filepath: mSDCard2Path=" + mSDCard2Path);
    Log.i("algerheTest",
            "filepath: Environment.isExternalStorageRemovable()=" + Environment.isExternalStorageRemovable());

    Log.i("algerheTest", "filepath: isExistSDCard()=" + isExistSDCard());

    String TRACKFILEROOT = this.getExternalFilesDir("Android").getAbsolutePath();
    Log.i("algerheTest", "filepath: TRACKFILEROOT=" + TRACKFILEROOT);
}