Spinner choice

Last Updated:

  1. ConnorCZ

    ConnorCZ New Member

    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 :)

  2. tneva82

    tneva82 Active Member

    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.

Share This Page