Getting float/double from NumberPicker

旧城冷巷雨未停 提交于 2019-12-02 00:55:28

I just tested using your code. getValue() actually returns the index of the item selected (only when you set the displayed values). All you'll need to do is parse the string and you will have what you wanted.

String[] nums = {"1","1.5","2","2.5","3","3.5","4","4.5","5","5.5","6","6.5","7","7.5","8","8.5","9"};
int index = listeningScorenp.getValue();
String val = nums[index];
float selectedFloat = Float.parseFloat(val);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!