Android: Storing Image into project directory (files)? -


i want store bitmap image project directory. how can have access project folder or address of project folder?

you have put images in res/drawable folder. then, can access them using: r.drawable.name_of_image (for name_of_image.png or name_of_image.jpg).

if want access them original name, better save them in assets folder. then, can access them using assetmanager:

assetmanager = getresources().getassets(); try {     inputstream = am.open("image.png");     // use input stream want } catch (ioexception e) {     e.printstacktrace(); } 

if want save programatically created image, can do:

try {        fileoutputstream out = new fileoutputstream(context.getfilesdir().getabsolutepath()+"/imagename.png");        bmp.compress(bitmap.compressformat.png, 100, out); } catch (exception e) {        e.printstacktrace(); } 

you can't save project directory. recommend read documentation how android packages work, because seems don't understand.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -