我要检查该项目是否在收藏夹中。在此活动的负载上显示收藏夹图标。请帮帮我,谢谢。
Lfunc
这是菜单的单击侦听器,用于更新数据库中的收藏夹列。我想在“创建选项”菜单上阅读该特定列。
public boolean onCreateOptionsMenu(Menu menu) {
this.menu = menu;
getMenuInflater().inflate(R.menu.favorite_menu,menu);
Databasehelper databasehelper = new Databasehelper(this);
SQLiteDatabase sqLiteDatabase= databasehelper.getReadableDatabase();
// what should I do here ???
return true;
}
答案 0 :(得分:0)
尝试一下
String select_query = "SELECT * FROM " + TableName + " where " + idorwhatever +"= " value+" ";
Cursor cursor = sqldb.rawQuery(select_query,null);
// for each item
if (cursor.moveToFirst()){
do {
// do stuff here, use cursor.getString(index)
} while (cursor.moveToNext());
}