How to get spinner value without tag

点点圈 提交于 2020-01-06 15:04:19

问题


I'm using the spinner, and I want to get the text selected for the user so I'm using

String datacat = categorySpinner.getSelectedItem().toString()

the problem is that this sentence also return the tag of the spinner in a String like this: {supplier=VITA}, but I need to get only the VITA value


回答1:


Assuming selectedview is EditText.

String datacat =((EditText) categorySpinner.getSelectedView()).getText().toString();



回答2:


try

String datacat = categorySpinner.getSelectedView().getText().toString()

you may have to cast the view before you can call getText()



来源:https://stackoverflow.com/questions/9524343/how-to-get-spinner-value-without-tag

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!