我有一个列表视图,其中填充了来自我的数据库的数据。我使用simpleCursorAdapter来显示值。获取SimpleCursorAdapter中的外键值
我有一个表,我可以加课:英语,法语......
在另一张表,我可以创建developped课(我加开始和结束,这天的日期,主题为教训)。我必须以FK的身份提供这个教训。
当我添加一个课程时,在我的listView中,我想显示每个示例:英语 - 阅读,但它显示1 - 阅读。因为1是我在第二张表中存储的值。
如何将1改为英文?
这里是我的代码:
Cursor cursor = dbhelper.getAllCours();
String[] from = { "branche_cours", "designation" }; //here 'branche_cours' is the lesson i store as an INT, it's the FK so
int[] to = { R.id.text_branche_cours, R.id.text_designation };
adapter = new SimpleCursorAdapter(this, R.layout.list_row, cursor, from, to, 0);
lvCours.setAdapter(adapter);
adapter.notifyDataSetChanged();
我使用getAllCours()
public Cursor getAllCours()
{
//from here, i retrieve the ID, designation and branche_cours
String Query = ("select ID as _id, date_debut, date_dernier, dixieme_point, " +
"demi_point, description, designation, lundi, mardi, mercredi, jeudi," +
" vendredi, samedi, branche_cours from " + TABLE_COURS);
Open();
Cursor cursor = db.rawQuery(Query, null);
return cursor;
}
我如何可以链接的int实际价值(所以如何能在 '1' 变成“英语的方法“)?
我还没有找到解决办法.. – David