lundi 29 décembre 2014

Display items in a listview

Hi i would like to know how can i display one column of my sqlite database into a list fragment How can i modifiy this to display it into the list :



Cursor c=db.rawQuery("SELECT * FROM student, null);
if(c.moveToFirst())
{

editMarks.setText(c.getString(2));
}


Maybe i need to turn this cursor into a cursor adapter (i don't know how to do this)


my sqlite database is also define in my main activity like thi :



db=openOrCreateDatabase("StudentDB", Context.MODE_PRIVATE, null);
db.execSQL("CREATE TABLE IF NOT EXISTS student(rollno VARCHAR,name VARCHAR,marks VARCHAR);");


Here i can get only the second column it's waht i want just want to display that in a list instead of a message box.


Thanks in advance for your help


Aucun commentaire:

Enregistrer un commentaire