title: how to Save bitmap image into my gallery folder in android?
body: <p>This is my code for saving the image. I have mentioned the folder name also in which I want to save the image so it will be in gallery but its not working my Image is getting saved in default "Pictures" folder. When I debug, it shows </p>
  
  <p><em>java.io.FileNotFoundException: /storage/emulated/0/MyFolderName/aaa-13:15:44/1-4-2016.jpg: open failed: ENOENT (No such file or directory)</em></p>
  
  <p>exception. It goes to catch folder just after executing first line of try block.</p>
  
  <p>Help please, what I am missing????</p>
  
  <p>thank you in advance...</p>
  
  <pre><code>    public void saveImage(Bitmap bitmap){
      String root = Environment.getExternalStorageDirectory().toString();
      File myDir = new File(root + "/MyFolderName"); //my folder name where I want to save.
      String receiverN = receiverName.getText().toString();
  
      myDir.mkdirs();
      Calendar c = Calendar.getInstance();
      String month, day, year, hour, minute, second;
      month = ""+ (c.get(Calendar.MONTH)+1);
      day = "" + c.get(Calendar.DAY_OF_MONTH);
      year = "" + c.get(Calendar.YEAR);
      hour = ""+c.get(Calendar.HOUR_OF_DAY);
      minute = "" + c.get(Calendar.MINUTE);
      int seconds = c.get(Calendar.SECOND);
      if (seconds&lt;10) second = "0"+ seconds;
      else second = ""+seconds;
  
      String fname = receiverN + "-" + hour + ":" + minute + ":" + second + "/"  + month + "-" + day + "-" + year +".jpg";
      File file = new File (myDir, fname);
      if (file.exists ()) file.delete ();
      try {
          FileOutputStream out = new FileOutputStream(file); //from here it goes to catch block
          bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
          out.flush();
          out.close();
          String[] paths = {file.toString()};
          String[] mimeTypes = {"/image/jpeg"};
          MediaScannerConnection.scanFile(this, paths, mimeTypes, null);
      } catch (Exception e) {
          e.printStackTrace();
      }
  }
  </code></pre>