Sqlite database entries pass to array list?

Posted by Rjay Guillermo Baltazar on Stack Overflow See other posts from Stack Overflow or by Rjay Guillermo Baltazar
Published on 2013-11-12T23:38:05Z Indexed on 2013/11/13 3:54 UTC
Read the original article Hit count: 199

Filed under:

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;
}

© Stack Overflow or respective owner

Related posts about android