Device claims external storage, yet I have no SD card

前端 未结 3 1683
忘了有多久
忘了有多久 2021-01-20 01:29

Samsung galaxy S3 with no SD card, I\'m using this code to check storage states.

Using this code:

boolean mExternalStorageAvailable = false;
boolean          


        
3条回答
  •  盖世英雄少女心
    2021-01-20 02:08

    Use this code to know if there is a memory card in the device:

    Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
    
    if(isSDPresent)
    {
      // yes SD-card is present
    }
    else
    {
     // Sorry
    }
    

提交回复
热议问题