0

I am trying to create a directory in Oreo but its failed.but working fine in Nougat and below. I have added Runtime Storage Permission already.

        File myDir = null;
        boolean status = false;
        File downloadedImage;
        try {
            URL url = new URL(mediaUrl);
            URLConnection connection = url.openConnection();
            connection.connect();
            fileLength = connection.getContentLength();
            myDir = new File(Environment.getExternalStorageDirectory(),"/RealInstagram/media/");
            if (!myDir.exists()) {
                myDir.mkdirs();
            }
         }
Dany Pop
  • 3,590
  • 2
  • 21
  • 28

0 Answers0