Check if directory exist on android's sdcard

前端 未结 6 744
时光说笑
时光说笑 2020-12-24 05:01

How do I check if a directory exist on the sdcard in android?

6条回答
  •  没有蜡笔的小新
    2020-12-24 05:11

    File dir = new File(Environment.getExternalStorageDirectory() + "/mydirectory");
    if(dir.exists() && dir.isDirectory()) {
        // do something here
    }
    

提交回复
热议问题