Getting values from the spinner inside the list

后端 未结 2 1820
忘了有多久
忘了有多久 2021-01-29 01:14

I\'ve create the android application program using list adapter that extends the list activity....Inside the list i am having the spinner.. how can i get the value from the spin

相关标签:
2条回答
  • 2021-01-29 01:25

    try this ::

    @Override
            public void onItemSelected(AdapterView<?> parent, View view,
                    int position, long id) {
    
            String str = mSpinner.getSelectedItem().toString();
            // getting item id by this
                myId = parent.getItemAtPosition(position).toString();
            }
    
    0 讨论(0)
  • 2021-01-29 01:35

    I am assuming you only have one spinner in the list. In that case you can get the view by id of that spinner and fetch the value. If there are more than one then you need to add different tags to them while adding them to the list (in ListAdpater) and get these views from tag and get the value.

    0 讨论(0)
提交回复
热议问题