如何检查是否新创建的文件夹为present成Android的SD卡文件夹、present、SD、Android

2023-09-04 04:01:21 作者:  ミм.吆 厷 ▓. | ミм.吆 嘙 ▓.

这是我的应用程序,我想一些图片保存到我的SD卡。为此,我需要创建一个文件夹。

From my application, I want to store some images into my SD card. For that I need to create a one folder.

目前首次夹将创建,但它会检查该文件夹是否是present或不是之后。我该怎么办呢?

At the first time folder will create but after it checks whether that folder is present or not. How can I do it?

推荐答案

低于code将创建一个目录,如果它不存在

below code will create a directory if it does not exist

   File direct = new File(Environment.getExternalStorageDirectory() + "/New Folder");

   if(!direct.exists())
    {
        if(direct.mkdir()) 
          {
           //directory is created;
          }

    }
 
精彩推荐
图片推荐