android - How can get an image from an image view? -


i trying image put image view. approach:

// image in image view     bytearrayoutputstream outputstream = new bytearrayoutputstream();     bitmap mybitmap = mimageview.getdrawingcache();     mybitmap.compress(compressformat.png, 0, outputstream); 

then want insert database:

mdbhelper.createreminder(outputstream); 

the databaseadapter looks this:

public long createreminder(bytearrayoutputstream outputstream) {     contentvalues initialvalues = new contentvalues();     initialvalues.put(key_image, outputstream.tobytearray());             return mdb.insert(database_table, null, initialvalues); } 

when tried app crashed. think statements somehow faulty. ideas???

drawable drawable = mimageview.getdrawable(); if (drawable instanceof bitmapdrawable) {     bitmapdrawable bitmapdrawable = (bitmapdrawable) drawable;     bitmap bitmap = bitmapdrawable.getbitmap(); } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -