我是android新手,我已经使用带有图像的sqlite创建了一个数据库。当我查看我插入到数据库中的所有数据时,只有热度(字符串行)显示所有记录,但图像只显示第一行。任何人都可以请帮助我,我现在很绝望。
public String getHot() {
// TODO Auto-generated method stub
String[] columns = new String[] { KEY_HOTNESS };
Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null,null,null);
String hotness = "";
int iRow = c.getColumnIndex(KEY_HOTNESS);
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
hotness = hotness + c.getString(iRow) + "\n";
}
return hotness;
}
public byte[] getImage1(int id) {
// TODO Auto-generated method stub
String[] columns = new String[] { KEY_ROWID, KEY_NAME, KEY_HOTNESS,
KEY_IMAGE1, KEY_IMAGE2, KEY_IMAGE3, KEY_IMAGE4,KEY_IMAGE5 };
Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null,
null, null);
if (c == null) {
return null;
}
byte[] iMage1 = null;
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
iMage1 = c.getBlob(c.getColumnIndexOrThrow(KEY_IMAGE1));
}
return iMage1;
}