title: How to get URI from filename which is saved in the external Storage using Scoped Storage in android 10 and above?
body: <p>Before SDK 29 this is the correct way to find the Uri but now it won't work anymore for sdk greater than 28. <strong>Let's assume I save the BITMAP using scoped-storage like:</strong></p>
  <pre><code>@RequiresApi(api = Build.VERSION_CODES.Q)
  @NonNull
  private Uri saveBitmap(@NonNull final Context context, @NonNull final Bitmap bitmap,
                         @NonNull final Bitmap.CompressFormat format, @NonNull final String mimeType,
                         @NonNull final String displayName, @Nullable final String subFolder) throws IOException {
      String relativeLocation = Environment.DIRECTORY_PICTURES;
  
      if (!TextUtils.isEmpty(subFolder)) {
          relativeLocation += File.separator + subFolder;
      }
  
      final ContentValues contentValues = new ContentValues();
      contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, displayName);
      contentValues.put(MediaStore.MediaColumns.MIME_TYPE, mimeType);
      contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, relativeLocation);
  
      final ContentResolver resolver = context.getContentResolver();
  
      OutputStream stream = null;
      Uri uri = null;
  
      try {
          final Uri contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
          uri = resolver.insert(contentUri, contentValues);
  
          if (uri == null) {
              throw new IOException(&quot;Failed to create new MediaStore record.&quot;);
          }
  
          stream = resolver.openOutputStream(uri);
  
          if (stream == null) {
              throw new IOException(&quot;Failed to get 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;
      } finally {
          if (stream != null) {
              stream.close();
          }
      }
  }
  </code></pre>
  <p>This code works for SDK &lt;= 28. <strong>But, How to get URI using fileName which is saved in the external storage for SDK version 29 and above?</strong></p>
  <pre><code>private String getFilePathUri(String enteredFileName) {
  
      String file_uri_string = Environment.getExternalStorageDirectory() + &quot;/&quot;
              + AppConstants.APP_FOLDER + &quot;/&quot; + enteredFileName + &quot;.jpg&quot;;
      AppUtils.showLog(TAG, file_uri_string + &quot;&quot;);
      return file_uri_string;
  
  }
  </code></pre>