External storage

  1. Determine whether the SDK is available
 if ((Environment.MEDIA_MOUNTED).equals(Environment.getExternalStorageState())){
                            Toast.makeText(getApplicationContext(),"sdk可用" ,Toast.LENGTH_LONG).show();
                        }
  1. Get external storage path String path = Environment.getExternalStorageDirectory (). GetPath (); Obsolete
    FileOutputStream fileOutputStream = new FileOutputStream (new File (path, "c.txt"));
  2. 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

Published 16 original articles · Likes0 · Visits 842

Guess you like

Origin blog.csdn.net/weixin_45830683/article/details/103102610