Reading and writing a file
<p>I downloaded a jpg from the net, I'd like to save it to disk then load it again. I'm trying something like this:</p>

<pre><code>Bitmap bmp = ...; // loaded from net.
File file = new File(Environment.getExternalStorageDirectory(), "tmp.jpg");
OutputStream out = getContentResolver().openOutputStream(Uri.parse(file.getAbsolutePath())); 
bmp.compress(Bitmap.CompressFormat.JPEG, 70, out); 
out.flush();
out.close();

...

File f2 = new File(Environment.getExternalStorageDirectory(), "tmp.jpg");
Uri uri = Uri.fromFile(f2);
</code></pre>

<p>but I keep getting an error on the second line when trying to create the new File() instance:</p>

<p>java.io.FileNotFoundException: No content provider: /sdcard/tmp.jpg</p>

<p>I'm using a 2.0 emulator and it has an sdcard. What am I doing wrong?</p>

<p>Thanks</p>
