title: Get a Content URI from a File URI?
body: <p>I am using the <a href="http://developer.android.com/reference/android/app/DownloadManager.html" rel="noreferrer">DownloadManager</a> to download an image to the system's gallery and then in the Broadcast receiver (once the download succeeds) using an Intent to set the image as the wallpaper. </p>
  
  <p>Everything was working fine but then recently on 4.4 I started to get an exception in the Photos/Google+ app because it is expecting a content URI and not a file URI. </p>
  
  <p>So my question is if anyone knows how to convert a full file path/URI (file://) into a content style URI (content://)?</p>
  
  <p>Sorry for the lack of source code, I am away from the computer that has the source, but I hope the question makes sense without it, get a content style uri from a full path.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>The image is copied into the system's gallery or media gallery, not saved within my apps internal storeage.</p>
  
  <p>Here is an example of what I want to convert:</p>
  
  <pre><code>file:///storage/emulated/0/Pictures/Rockstar/image.jpg
  </code></pre>
  
  <p>to</p>
  
  <pre><code>content://media/internal/images/media/445
  </code></pre>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Here is the error that I get from the Google+ app:</p>
  
  <pre><code>04-21 10:50:35.090: E/AndroidRuntime(7220): FATAL EXCEPTION: main
  04-21 10:50:35.090: E/AndroidRuntime(7220): Process: com.google.android.apps.plus, PID: 7220
  04-21 10:50:35.090: E/AndroidRuntime(7220): java.lang.RuntimeException: Unable to resume activity
  {com.google.android.apps.plus/com.google.android.apps.photos.phone.SetWallpaperActivity}:  
  java.lang.IllegalArgumentException: Image URI must be of the content scheme type
  </code></pre>
  
  <p>Here is the code that I use to let the user set the wallpaper:</p>
  
  <pre><code>String uriString = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI));
  Uri u = Uri.parse(uriString);
  Intent wall_intent =  new Intent(Intent.ACTION_ATTACH_DATA);
  wall_intent.setDataAndType(u, "image/*");
  wall_intent.putExtra("mimeType", "image/*");
  Intent chooserIntent = Intent.createChooser(wall_intent,
      "Set As");
  chooserIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);      
  try {
      context.startActivity(chooserIntent);
  } 
  </code></pre>
  
  <p>Where <code>uriString</code> is:</p>
  
  <pre><code>file:///storage/emulated/0/Pictures/Rockstar/image.jpg
  </code></pre>