You could mean something else, but it isn't very clear what you mean.
UPDATED:
You can fake it by setting your own formatter:
CountryFormatter implements Formatter {
public String toString(int value) {
switch(value) {
case 0:
return "England";
case 1:
return "France";
}
return "Unknown";
}
}
picker.setFormatter(new CountryFormatter());
getValue() will still return an int, so you probably want to map the names of countries to their ids.
ADDED:
The implementation of NumberPicker has:
public void setRange(int start, int end, String[] displayedValues)
Which seems to do a better job of what you want then the above formatter.. although it isn't mentioned in the documentation so probably isn't part of the public api
NumberPicker pickers = new NumberPicker(this);
String[] arrayPicker= new String[]{"abc","def","ghi","jkl","mno"};
//set min value zero
pickers.setMinValue(0);
//set max value from length array string reduced 1
pickers.setMaxValue(arrayPicker.length - 1);
//implement array string to number picker
pickers.setDisplayedValues(arrayPicker);
//disable soft keyboard
pickers.setDescendantFocusability(NumberPicker.FOCUS_BLOCK_DESCENDANTS);
//set wrap true or false, try it you will know the difference
pickers.setWrapSelectorWheel(false);
//create button to test selected text string
btnPicker.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//get position (int) from number picker
int pos = pickers.getValue();
//get string from number picker and position
String selecPicker = arrayPicker[pos];
//test toast to get selected text string
Toast.makeText(context, selecPicker , Toast.LENGTH_SHORT).show();
}
});