How to populate spinner from database?
Following code is not working in my case.
This method shows database entries in spinner
private void fillData() {
spin_pro= (Spinner)findViewById(R.id.spin_profile);
Cursor profilesCursor = mDbHelper.retrieveAllProfiles();
startManagingCursor(profilesCursor);
String[] from = new String[]{DBAdapter.KEY_PRONAME};
int[] to = new int[]{R.id.tvDBViewRow};
SimpleCursorAdapter profile =
new SimpleCursorAdapter(this, R.layout.profile_list,
profilesCursor, from, to);
spin_pro.setAdapter(profile);
}
And this is database class to retrieve data
public Cursor retrieveAllProfiles()
{
return mDb.query(DATABASE_TABLE1, new String[] {KEY_PROID,
KEY_PRONAME, KEY_PASSWORD}, null, null, null, null,
null);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en