Android: construct a File from an android.net.URI
<p>I have an android.net.URI object (of the kind returned by onActivityResult after MediaStore.ACTION_VIDEO_CAPTURE): it looks like content://media/video/media/33.</p>

<p>I want to convert this into a File object, and only a File object - I need to pass it to another constructor that requires a File. </p>

<p>How can I convert a URI like this to a File object? If I try </p>

<pre><code>File newFile = new File(myURI);
</code></pre>

<p>I get an error in Eclipse suggesting that I should convert the URI to a String. Supplying URI.getPath() in the constructor doesn't help either.</p>

<p>This relates to the '<a href="http://stackoverflow.com/questions/559902/android-how-can-i-convert-android-net-uri-object-to-java-net-uri-object">How can I convert android.net.uri object to java.net.uri object?</a>' question, which unfortunately seems to have no good answer, but I want a File object out, not a java uri. </p>

<p>I don't mind if I have to write it to a bytestream and back again - whatever is the best way. </p>

<p>Apologies if I'm cross-posting <a href="http://stackoverflow.com/questions/2351633/java-constructing-a-file-from-a-uri">my own question</a>, but I thought I might need to make things a bit clearer. </p>
