title: android implicit intent edit failed to load image
body: <p>This is my implicit intent to invoke image editing apps on the device:</p>
  
  <pre><code>startActivity(new Intent(Intent.ACTION_EDIT).setDataAndType(myUri,
       getMimeType(myUri)).setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | 
       Intent.FLAG_GRANT_WRITE_URI_PERMISSION));
  </code></pre>
  
  <p>And this is how I getMimeType:</p>
  
  <pre><code>public String getMimeType(Uri uri) {
      String mimeType = null;
      if (uri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
          ContentResolver cr = getContentResolver();
          mimeType = cr.getType(uri);
      } else {
          String fileExtension = MimeTypeMap.getFileExtensionFromUrl(uri
                  .toString());
          mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(
                  fileExtension.toLowerCase());
      }
      return mimeType;
  }
  </code></pre>
  
  <p>For some apps it crashes to load:</p>
  
  <p>On the app <code>Sketch_Camera</code> only an invisible page loads up and disables interaction with my app. </p>
  
  <p>On the app <code>AirBrush</code> it loads the app but crashes with this message "Failed to load image".</p>
  
  <p>Is it related to minimum sdk version as mine is 16?
  I've tested this on minimum sdk version of 9 too and no change in result.</p>
  
  <p>Is there anything else that I should add to this intent to work with all the apps?</p>
  
  <p>I've tried putExtra too and it doesn't help:</p>
  
  <pre><code>.putExtra(Intent.ACTION_EDIT, myUri);
  </code></pre>
  
  <p>I've some gallery apps on my device and all of them launch <code>Sketch_Camera</code> and <code>AirBrush</code> without any problem.</p>
  
  <p>What's happening here? I'm so confused after two days of struggling with this phenomena.</p>