我的代码
private static String getSDCardPath() {
boolean sdCardExist = Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState());
if (sdCardExist) {
return Environment.getExternalStorageDirectory().toString();
}
return null;
}
引起:
java.lang.NullPointerException
at android.os.Environment.getExternalStorageState(Environment.java:602)