• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps problem with blob

set one image for every id in my database but only got the first row blob !

this is my database.java :

public byte[] getpic(int id){
Cursor cu = mydb.rawQuery("select * from content where ID="+ id,null);
cu.moveToFirst();
byte s[]= cu.getBlob(cu.getColumnIndex("IMAGE"));
return s;
}
in main.java

private void load(String sea, String Name, int page3){

db.open();



byte[] p = db.getpic(page3);
Bitmap bm = BitmapFactory.decodeByteArray(p,0, p.length);
img.setImageBitmap(bm);

db.close();

}
what should i do???
 
The code fragment you posted has a query which selects only one row. Is this not what you expected?

Code:
select * from content where ID="+ id
my database is like this:
ID INTEGER /CHAPTER TEXT/STO_NAME TEXT/MATN TEXT/PAGE INTEGER/IMAGE BLOB
i want to show image of selected story in its activity but only first image(blob) will show!
 
There's not enough information to diagnose the problem. You need to show the code for your activity. Use a code insert and format it in a readable way.
 
Back
Top Bottom