dimanche 19 avril 2015

How to populate Drop Down box with database android

guys i want to populate my dropdown box with a column from my database. how to do it ?


this is my database code for get dataa.



`public String GetReviews() {
StringBuffer sb = new StringBuffer();
SQLiteDatabase database = getReadableDatabase();
Cursor cursor = database.rawQuery("SELECT SName, SFac FROM AddReview", null);
if (cursor.moveToFirst() && cursor.getCount()>0){
do{
sb.append(String.format("Station Name : %s\nFaculty:", cursor.getString(0), cursor.getString(1), cursor.getString(2)));
} while (cursor.moveToNext());
}
database.close();
return sb.toString().trim();

}`


this is my databse i want to populate my drop down list with the Name field from my database.


Aucun commentaire:

Enregistrer un commentaire