我为数据库中的每个id设置了一个图像,但只获得了第一行blob!
这是我的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;
}
在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();
}
我该怎么办?