I downloaded jpg from the network, I would like to save it to disk, and then download it again. I am trying something like this:
Bitmap bmp = ...;
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);
but all the time I get an error message in the second line when trying to create a new instance of File ():
java.io.FileNotFoundException: No content provider: /sdcard/tmp.jpg
I am using emulator 2.0 and have sdcard. What am I doing wrong?
thank
source
share