When the small fish in the project, encountered directly put bitmap into SQLite
The small fish logo is very confusing when removing the problem that causes the picture to be displayed.
followed the code discovery. The original data stored in and taken out of the different.
Why does it cause this situation?
is because The data type used by my project is not the result.
(If you turn the image type byte[] into a string it will invalidate the picture!) )
The solution I'm using is. Encodes a byte array into a string before decoding
<span style= "White-space:pre" ></span>byte[] Bitmap_byte=cursor.getblob (columnIndex);//Direct removal has a transmission problem, Solve Base64encoder encode = new Base64encoder () by adding decoding; String Encode_bitmap=encode.encode (Bitmap_byte);
Decoding:
<span style= "White-space:pre" ></span>string bitemap_string = (String) data.getrow (0). GetValue ( ColumnName);//decoder Base64decoder decode = new Base64decoder (); byte [] bitemap_byte=null;try {//decode operation bitemap_byte= Decode.decodebuffer (bitemap_string);} catch (IOException e) {log.e ("Convert picture Failed", GetClass (). GetName () + ""); E.printstacktrace ();}
Add the decryption device:
http://download.csdn.net/detail/u010962482/8748905
Android bitmap stored in SQLite and how to remove it without damage