Skip to content Skip to sidebar Skip to footer

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 fol

Solution 1:

below code will create a directory if it does not exist

Filedirect=newFile(Environment.getExternalStorageDirectory() + "/New Folder");

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

    }

Solution 2:

You should request the following permission first in your Android manifest :

android.permission.WRITE_EXTERNAL_STORAGE

and execute above code by Rasel for it to work.

Post a Comment for "How To Check If Newly Created Folder Is Present Into Sd Card In Android"