• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Spinner choice

ConnorCZ

Lurker
Hi guys,

I want to create an app, but I have first little problem.

I have a Spinner and TextView and some strings in resources. And I want to make, when I choose some item from Spinner, for example, Czech Republic, I want to appear in TextView "Capital City: Prague".

Any idea how to do that? Thanks a lot :)
 
Pretty sure it goes by attaching something like following to spinners onChange event. The pos is selected item(from 0 onward).

public class MyOnItemSelectedListener implements OnItemSelectedListener {

public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
// here alter the textview
}

public void onNothingSelected(AdapterView parent) {
// Do nothing.
}
}
 
Back
Top Bottom