Subjectとchapterという 2 つのテーブルがあります。Subject_idを渡してchapter_nameを表示する必要があります。私の質問は、それを行う方法ですか?値 id を渡すと、何も返されません。
ヒントをください。
参照用の私のコードは次のとおりです。
public List<ObjectiveWiseQuestion> getAllChapter(long subId)
{
List<ObjectiveWiseQuestion>LocwiseProfileList=new ArrayList<ObjectiveWiseQuestion>();
String selectQuery=("select chapterName from chapter where subject_id ='"+ subId +"'");
db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst())
{
do {
ObjectiveWiseQuestion owq= new ObjectiveWiseQuestion();
owq.setChapterName(cursor.getString(2));
LocwiseProfileList.add(owq);
} while(cursor.moveToNext());
db.close();
}
return LocwiseProfileList;
}
また、 illegalState Exceptionも示しています。