Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if newly created folder is present into SD Card in Android

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

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

like image 963
Jyosna Avatar asked Aug 02 '11 11:08

Jyosna


1 Answers

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;
          }

    }
like image 197
Rasel Avatar answered Sep 23 '22 20:09

Rasel