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

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -