- Determine whether the SDK is available
if ((Environment.MEDIA_MOUNTED).equals(Environment.getExternalStorageState())){
Toast.makeText(getApplicationContext(),"sdk可用" ,Toast.LENGTH_LONG).show();
}
- Get external storage path String path = Environment.getExternalStorageDirectory (). GetPath (); Obsolete
FileOutputStream fileOutputStream = new FileOutputStream (new File (path, "c.txt")); - Permissions but still will refuse permission errors It is said that Android 6.0 and above need to dynamically add permissions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Get the total size of the
sdk Environment.getExternalStorageDirectory (). GetTotalSpace () Get the free space of the sdk