title: How to setOnValueChangedListener from NumberPicker inside a BaseAdapter
body: <p>I am trying to create a BaseAdapter which each element has a NumberPicker and a Button. The button's action parameters depends on the value picked in NumberPicker. One solution I thought was creating a setOnClickListener (of the button) inside the onValueChange of the NumberPicker, the problem is onValueChange never gets fired when I change the number.</p>
  
  <p>I leave you the code to make it clearer:</p>
  
  <pre><code>public class Adapter extends BaseAdapter{
  ...
  
    public View getView(int position, View convertView, ViewGroup parent) {
          View v = convertView;
          if (v == null)
          {
              LayoutInflater vi = (LayoutInflater) con.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              v = vi.inflate(R.layout.row, null);
          }
          button = (Button) v.findViewById(R.id.button);
          numPick = (NumberPicker) v.findViewById(R.id.numPick);
          numPick.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
              public void onValueChange(NumberPicker picker, int oldVal, int newVal) {
                  val = newVal;
                  button.setOnClickListener(new View.OnClickListener() {
                      public void onClick(View arg0) {
                          actionToPerform(val);
                      }
                  });
              }
          });
  </code></pre>
  
  <p>How can I solve this problem? Thank you!</p>