Cuando estoy recuperando el valor de blob de SQLite, da un valor diferente ya que está almacenado en la base de datos

When I'm retrieving blob value from SQLite it gives different value as it is stored in database. I don't know why this is happening. When I'm using cursor.getString(), it gives the same value. But when I use curser.getBlob(), it gives different value. Also when I convert cursor.getString() valor en bytes[] usar getBytes() it again gets converted into different vlaue which is stored in database.

Please tell me the solution as am not able to find why this is happening.

preguntado el 31 de julio de 12 a las 13:07

post your code to solve the issue -

1 Respuestas

i think you have used insert query to insert data into sqlite database. in my opinion you shud use the following method to insert data also image.

CREATE TABLE IF NOT EXISTS " + DB_TABLE + "("+ 
               KEY_NAME + " TEXT," + 
               KEY_IMAGE + " BLOB);";

ContentValues cv = new  ContentValues();
cv.put(KEY_NAME,    name);
cv.put(KEY_IMAGE,   image);
database.insert( DB_TABLE, null, cv );

Use this method it should work. if not then plz let me know about it. Gud luck.

Respondido 09 ago 12, 22:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.