Reputation: 37
Q1:Is it possible to use a number picker for data ?
I just tried to do by next code to set string values in the Number Picker but when i roll the picker to see the next value the application crash here is the code:
String[] manga={"death note","runway","blood bro"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
NumberPicker pic=(NumberPicker) findViewById(R.id.numberPicker1);
pic.setMaxValue(manga.length);
pic.setMinValue(0);
pic.setWrapSelectorWheel(false);
pic.setDisplayedValues(manga);
}
Upvotes: 0
Views: 849