In the SCHED table, ID_GROUP records the _id group from the GROUPS table. How can I, through the query query in the ListView, display instead of the key in ID_GROUP, a record from the GROUPS table by _id?
The code for creating these tables in the database:
db.execSQL("create table GROUPS (_id integer primary key autoincrement, " + "NAME_OF_GROUP text);"); db.execSQL("create table SCHED (_id integer primary key autoincrement, " + "COUPLE text, " + "PREDMET text, " + "ID_GROUP text, " + "TYPE text, " + "CAB text, " + "DAY text, " + "WEEK text);"); The code to display information from the database in the ListView:
cursor = db.query("SCHED", new String[]{"_id", "COUPLE", "PREDMET", "ID_GROUP", "TYPE", "CAB","DAY", "WEEK"}, "DAY = ? AND WEEK = ?", new String[]{day, week },null, null, null); {day,week}); CursorAdapter listAdapter = new SimpleCursorAdapter(this, R.layout.list_row, cursor, new String[]{"COUPLE", "PREDMET", "ID_GROUP", "TYPE", "CAB"}, new int[]{R.id.coupleView, R.id.predmetView, R.id.groupView, R.id.typeView, R.id.cabView }, 0); listView.setAdapter(listAdapter);