-2

I am trying to create a directory in the internal storage into an Android device using the following code but it seems like I am missing something. The directory is not showing in the internal storage. I have tried this code:

File testDir = DirectoryTestActivity.this.getDir("Test", Context.MODE_PRIVATE);
      if (!testDir.exists())
      {
        testDir.mkdirs();
      }
Tepits
  • 374
  • 6
  • 19
  • you mean to say in app preference?? because you added this Context.MODE_PRIVATE – Learning Always Aug 02 '18 at 06:51
  • 1
    Please ensure that the question you asked is not exist in stack overflowPossible duplicate of [Android create folders in Internal Memory](https://stackoverflow.com/questions/8124612/android-create-folders-in-internal-memory) – Learning Always Aug 02 '18 at 06:54

1 Answers1

1

add you internal path in new File(your internal path )

    File newFolderVideos = new File(context.getFilesDir().getAbsolutePath() + "/Pictures");
   if (!newFolderVideos .exists()) {
    newFolderVideos.mkdirs();
    }
Ahsan Malik
  • 399
  • 2
  • 3
  • 13