title: how to save image in DCIM folder of external SDCARD in android 11?
body: <p>i am saving image in DCIM folder of internal storage by using below code:</p>
  <pre><code>    public Uri saveBitmap(@NonNull final Context context, @NonNull final Bitmap bitmap,
                        @NonNull final Bitmap.CompressFormat format,
                        @NonNull final String mimeType,
                        @NonNull final String displayName) throws IOException {
  
      final ContentValues values = new ContentValues();
      values.put(MediaStore.MediaColumns.DISPLAY_NAME, displayName);
      values.put(MediaStore.MediaColumns.MIME_TYPE, mimeType);
      values.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DCIM);
  
      final ContentResolver resolver = context.getContentResolver();
      Uri uri = null;
  
      try {
          final Uri contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
          uri = resolver.insert(contentUri, values);
  
          if (uri == null)
              throw new IOException(&quot;Failed to create new MediaStore record.&quot;);
  
          try (final OutputStream stream = resolver.openOutputStream(uri)) {
              if (stream == null)
                  throw new IOException(&quot;Failed to open output stream.&quot;);
           
              if (!bitmap.compress(format, 95, stream))
                  throw new IOException(&quot;Failed to save bitmap.&quot;);
          }
  
          return uri;
      }
      catch (IOException e) {
  
          if (uri != null) {
              // Don't leave an orphan entry in the MediaStore
              resolver.delete(uri, null, null);
          }
  
          throw e;
      }
  }
  </code></pre>
  <p>now i want to save image in DCIM folder of external SDCARD but i don't know how to do it.</p>
  <p>i know that i have to made changes in this line :</p>
  <pre><code>values.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DCIM);
  </code></pre>
  <p>but <code>Environment.DIRECTORY_DCIM</code> always return DCIM Folder of internal storage.</p>