I"m trying to add the onValueChangeListener to my number picker (np1) in android 4.2.2.
Here's what I have so far
public class main extends Activity {
ViewFlipper vf = null;
HttpClient client = null;
private ArrayList<String> captionList = new ArrayList<String>();
ListView lv = null;
private String custid = null;
ImageView iv = null;
private int vfloginview = 0;
private int vflistview = 0;
private boolean vfsentinal = false;
NumberPicker np1 = null;
TextView totalcost = null;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mystuffmobile);
vf = (ViewFlipper) findViewById(R.id.vf);
client = new DefaultHttpClient();
lv = (ListView) findViewById(R.id.lv);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
np1 = (NumberPicker) findViewById(R.id.np1);
np1.setMinValue(1);
np1.setMaxValue(400);
//np1.setOnValueChangedListener;
//np1.setOnValueChangedListener(onValueChange);
}
to try to test it's functionality I've been using this
public void onValueChange (NumberPicker np1, int oldVal, int newVal) {
Log.v("NumberPicker", np1.getValue() +"");
}
Does anyone know an easy way to implement this listener without having my main activity implement NumberPicker.OnValueChangeListener?
Note: the only reason I'm opposed to having my main activity implement NumberPicker.OnValueChangeListener is because then I have to set main to abstract and my application won't run.