java - How to use a string in rawquery? -
i'm creating app on android studio.i randomly question using getquestion cursor first id = 0(will change else later)
sqlitedatabase mydatabase = this.openorcreatedatabase("questions", mode_private, null); cursor getquestion = mydatabase.rawquery("select question questions id = '0' order random() limit 1",null); int questionindex = getquestion.getcolumnindex("question");
in same table there answer column.i answer of question randomly got getquestion query using this
cursor getanswer = mydatabase.rawquery("select answer questions question = ?");
i couldnt find how use question string , use in getanswer query.what should ?
just read both columns same query:
cursor getquestion = mydatabase.rawquery("select question, answer ..."); int questionindex = getquestion.getcolumnindexorthrow("question"); int answerindex = getquestion.getcolumnindexorthrow("answer"); ...
Comments
Post a Comment