-2

I have a following question - I've created NumberPicker and also I've set minValue and maxValue for it. Is there any way to exclude one certain value from list of values?

Here's my code for NumberPicker:

public class YearSelectionActivity extends AppCompatActivity {

NumberPicker yearPicker;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_year_selection);
    yearPicker = findViewById(R.id.numberPicker);
    yearPicker.setMinValue(2006);
    yearPicker.setMaxValue(2018);
 }
}

For example, I want to exclude 2011 from this list, is there any way to do that, using standart NumberPicker?

Aldres
  • 185
  • 1
  • 3
  • 16

1 Answers1

1

You can use

numberPicker.setDisplayedValues(String[] displayedValues);

to display custom values for the number picker. Create a String array with the values that you want to display and use the setDisplayedValues method to display them

Napster
  • 1,353
  • 1
  • 9
  • 11