Code example for NumberPicker

Methods: setOnValueChangedListener

    // Listen for changes to each 'picker', if changes are detected, update the global color, 
    // then the background using RGB. 
    private void pickerListener(NumberPicker picker, final String colorType) {
      picker.setOnValueChangedListener(new NumberPicker.OnValueChangeListener() {
        public void onValueChange(NumberPicker picker, int oldVal, int newVal) {	
          updateColor(colorType, newVal);
    // Update the global color variable, which color is updated is based on the 'colorType'  
    // which is a flag determined by the original picker listener type. 
    private void updateColor(String colorType, int color) {
      if (colorType == "r")
        red = color;
      if (colorType == "g")