java - How do I get the URI of a file saved with FileOutputStream? -


here's code saves image file to... somewhere? how uri file "webimage"?

bitmap bmp = ((bitmapdrawable)imageview.getdrawable()).getbitmap();         string filename = "webimage";//no .png or .jpg needed         try {             bytearrayoutputstream bytes = new bytearrayoutputstream();             bmp.compress(bitmap.compressformat.jpeg, 100, bytes);             fileoutputstream fo = openfileoutput(filename, context.mode_private);             fo.write(bytes.tobytearray());             // remember close file output             fo.close();         } catch (exception e) {             e.printstacktrace();         } 

use getfilestreampath() this:

string filename = "webimage"; //... uri uri = uri.fromfile(getfilestreampath(filename)); 

Comments