我怎么知道是否有内部和外部存储在Android的务实?没有人怎么知道如何检查内部和外部存储
How do i know if there are internal and external storage in android pragmatically? does anyone how to know how to check both internal and external storage
在此先感谢
它已经在的 Android的文档。
从文档拍摄的 code
boolean mExternalStorageAvailable = false;
boolean mExternalStorageWriteable = false;
String state = Environment.getExternalStorageState();
if (Environment.MEDIA_MOUNTED.equals(state)) {
// We can read and write the media
mExternalStorageAvailable = mExternalStorageWriteable = true;
} else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
// We can only read the media
mExternalStorageAvailable = true;
mExternalStorageWriteable = false;
} else {
// Something else is wrong. It may be one of many other states, but all we need
// to know is we can neither read nor write
mExternalStorageAvailable = mExternalStorageWriteable = false;
}