Check if the SDCard is present, boolean is always true

前端 未结 7 2014
故里飘歌
故里飘歌 2020-11-29 05:42

In my splash screen, I want to check if the phone has a SDCard. The Boolean statement is beneath:

    Boolean isSDPresent = android.os.Environment.getExterna         


        
7条回答
  •  悲哀的现实
    2020-11-29 06:02

    I modificated that if sd card exists, sets the path there if not sets it at the internal directory

        Boolean isSDPresent = android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
        if(isSDPresent)
        {
          path = theAct.getExternalCacheDir().getAbsolutePath() + "/GrammarFolder";
        }
        else
        {
            path = theAct.getFilesDir() + "/GrammarFolder";
        }
    

提交回复
热议问题