Android SD卡读写Environment.getExternalStorageState()

tech2023-09-06  113

读写SD卡权限:

<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

读写SD卡 Environment.MEDIA_MOUNTED /mnt/sdcard目录才是可读可写

String state; String path; state = Environment.getExternalStorageState(); if(state.equals(Environment.MEDIA_MOUNTED)){ path = Environment.getExternalStorageDirectory().getAbsolutePath();
最新回复(0)