开发者

why onItemSelected() not return "null" value when nothing selected from spinner

开发者 https://www.devze.com 2023-03-08 11:20 出处:网络
in my app i have a spinner and a button below it when i run the program suppose this page is open开发者_Python百科 which contains spinner and a button ,when i dont select any item from spineer it take

in my app i have a spinner and a button below it when i run the program suppose this page is open开发者_Python百科 which contains spinner and a button ,when i dont select any item from spineer it takes first values of spinner by default i want if nothing is selected it contains null value ..... how to do this??? thankss a lot my code is..


HI Saurabh,

I would suggest you to give your first spinner value as "--Select--" or some message. And try to validate in your code, by checking return value of the spinner which should not be the first manual value that you given into the spinner.

You can refer this page http://developer.android.com/resources/tutorials/views/hello-spinner.html


the parameter "position" records your selected item.so you can use this parameter.

0

精彩评论

暂无评论...
验证码 换一张
取 消