Setting Up Spinner Filled With Data Without Any Reference To Android Resources
Busy creating an interface with spinner (dropdown) programmatically. To populate with data you need an (Array)Adapter. What I don't understand is why you need a reference to an And
Solution 1:
Here is an example:
private void FillCitySnipper() {
ArrayList<MyCity> ListOfCity=db.LoadMyCity();
// TODO Auto-generated method stub
if (ListOfCity.size() > 0) {
Spinner spinner = (Spinner) this
.findViewById(R.id.spnr_Cityname);
ArrayAdapter<MyCity> spinnerArrayAdapter = new ArrayAdapter<MyCity>(
this,
android.R.layout.simple_spinner_dropdown_item,
ListOfCity);
spinner.setAdapter(spinnerArrayAdapter);
}
}
Post a Comment for "Setting Up Spinner Filled With Data Without Any Reference To Android Resources"