List of usage examples for android.content Context STORAGE_SERVICE
String STORAGE_SERVICE
To view the source code for android.content Context STORAGE_SERVICE.
Click Source Link
From source file:com.lewa.crazychapter11.MainActivity.java
private void justForTest() { int i = 2;/*from w w w .j a v a2 s . c o 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); }
From source file:com.android.mms.ui.MessageUtils.java
public static boolean existingSD(Context context, boolean isExternal) { StorageManager mStorageMamatger;//from w w w . j a v a 2 s. c o m mStorageMamatger = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); StorageVolume[] volumes = mStorageMamatger.getVolumeList(); if (volumes == null) { return false; } String mountPoint = null; for (int i = 0; i < volumes.length; i++) { if (isExternal) { if (volumes[i].isRemovable()) { mountPoint = volumes[i].getPath(); break; } } else { if (!volumes[i].isRemovable()) { mountPoint = volumes[i].getPath(); break; } } } if (mountPoint == null) { return false; } String volumeState = mStorageMamatger.getVolumeState(mountPoint); return (volumeState != null && volumeState.equals(Environment.MEDIA_MOUNTED)); }