Sqlite database entries pass to array list?
- by Rjay Guillermo Baltazar
This is my code in getting the question into SQLite Database . I want to pass the questions into array list ? is it possible to my code ? Thanks for your help .
public String getquestions() {
// TODO Auto-generated method stub
String[] sqlSelect = { "0 _id", "question", "answer" };
String sqlTables = "mytables";
SQLiteDatabase db = getWritableDatabase();
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(sqlTables);
String result = "";
c = qb.query(db, sqlSelect, null, null, null, null, null);
int id = c.getColumnIndex(ID);
int question = c.getColumnIndex(ROW1);
int answer = c.getColumnIndex(ROW2);
c.moveToFirst();
result = result + c.getString(question) + c.getString(count);
return result;
}