Uthra
Uthra

Reputation: 21

How to use the spinner inside the listview that extends listactivity

I've create the android application using listactivity..in my program i have the spinner inside the listview..i don't know how to use and get the value from the spinner..pls tell some idea ..Thanks in advance..

Upvotes: 1

Views: 557

Answers (1)

Steve Bergamini
Steve Bergamini

Reputation: 14600

The type of view your spinner is in does not effect how you get the value of it. You basically have 2 choices depending on your needs.

  1. If you don't need to listen for the event of a selection being made, you can just grab the value with the Spinner class's getSelectedItem() method.
  2. If you do need to listen for the event, you'll need to implement the OnItemSelectedListener in an inline or nested class. You can see how to do that here: http://developer.android.com/resources/tutorials/views/hello-spinner.html

Another quick note in regard to listeners and listviews - keep in mind that if you're extending your own adapter class to customize your listview, you can create the listeners, store them in an object and then assign them in the getView() method of your adapter class.

Upvotes: 1

Related Questions