Check if file exists on SD card on Android

后端 未结 6 674
悲哀的现实
悲哀的现实 2020-12-05 20:57

I want to check if a text file exists on the SD card. The file name is mytextfile.txt. Below is the code:

FileOutputStream fos = openFileOutput(\"sdcard/myte         


        
6条回答
  •  死守一世寂寞
    2020-12-05 21:13

    *Using this you can check the file is present or not in sdcard *

    File file = new File(sdcardpath+ "/" + filename);
    if (file.exists())
     {
    
    }
    

提交回复
热议问题