title: How to save a photo in gallery
body: <p>Hello i make applicaiton with ss the phone screen, but this application store all photos on Local files in internal storage and every photo was not showing when i open my gallery in phone.</p>
  
  <p>So how to store every photo in Gallery folders?</p>
  
  <p>Here i take the SS</p>
  
  <pre><code>private void takeAScreenshot() {
      Date now = new Date();
      android.text.format.DateFormat.format("yyyy-MM-dd_hh:mm:ss", now);
      try {
          String mPath = Environment.getExternalStorageDirectory().toString()
                  + "/" + now + ".jpg";
          View v1 = getWindow().getDecorView().getRootView();
          v1.setDrawingCacheEnabled(true);
          Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache());
          v1.setDrawingCacheEnabled(false);
          File imageFile = new File(mPath);
          FileOutputStream outputStream = new FileOutputStream(imageFile);
          int quality = 100;
          bitmap.compress(Bitmap.CompressFormat.JPEG, quality, outputStream);
          outputStream.flush();
          outputStream.close();
      } catch (Throwable e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>i check the permissions</p>
  
  <p>i also find where is saved files from aparat:</p>
  
  <p>/storage/emulated/0/DCIM/Camera/img_name.jpg</p>
  
  <p>I find this, and this working:</p>
  
  <pre><code>ContentValues values = new ContentValues();
              values.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis());
              values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
              values.put(MediaStore.MediaColumns.DATA, mPath)
  </code></pre>
  
  <p>but images is save on gallery folders and internal storage, Help</p>