Example usage for android.os.storage StorageManager getVolumePaths

List of usage examples for android.os.storage StorageManager getVolumePaths

Introduction

In this page you can find the example usage for android.os.storage StorageManager getVolumePaths.

Prototype

@Deprecated
@UnsupportedAppUsage
public @NonNull String[] getVolumePaths() 

Source Link

Document

Returns list of paths for all mountable volumes.

Usage

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

private void justForTest() {
    int i = 2;/*from  w w 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);
}