Hello I have question about android spinner
I have spinner which is populated by array.The array is Country name and Country phone code on every row
Part of the array
<item>355 Albania</item>
<item>213 Algeria</item>
<item>376 Andorra</item>
<item>244 Angola</item>
<item>1264 Anguilla</item>
<item>1268 Antigua and Barbuda</item>
<item>54 Argentina</item>
This is my java code for populating the spinner
final Spinner spnCountry = (Spinner) findViewById(R.id.countries);
ArrayAdapter<CharSequence> adpCountry = ArrayAdapter.createFromResource(
this, R.array.countries, android.R.layout.simple_spinner_item);
adpCountry
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnCountry.setAdapter(adpCountry);
I want to show only country code on the box and when the spinner is opened to show country name and code on every row.
Can someone help me how to do that?
Loading the Spinner;
Selecting an item;
(out of heart)