title: How to get content-scheme Uri from file path?
body: <p>I've got a situation where I know the path of a file, and address it this way:</p>
  
  <pre><code>File f = new File(Environment.getExternalStorageDirectory(), "image.jpg");
  </code></pre>
  
  <p>And then create a Uri from it:</p>
  
  <pre><code>Uri uri = Uri.fromFile(f);
  </code></pre>
  
  <p>However, this Uri prints out something like:</p>
  
  <pre><code>file://.....
  </code></pre>
  
  <p>But I want:</p>
  
  <pre><code>content://.....
  </code></pre>
  
  <p>"Why?". Because some apps are scheme sensitive, like Facebook. If you pass a file-scheme Uri to Facebook when attaching an image, it does nothing. If you pass a content-scheme Uri to the same image, it works perfectly.</p>
  
  <p>So how can I get the content Uri, either by knowing the absolute path, or converting the file-scheme Uri to a content-scheme Uri?</p>
  
  <p><em>Edit (24th of August 2012): The latest Facebook app update "solved" this by simply removing the picker, and just showing the gallery. You can no longer pick via an intent at all in Facebook.</em></p>