android - selected item of a spinner in an if statement -


how can use if statement of spinner when selected value = 0?

if( wilayat.setselection(0) || city.setselection(0) ||     station.setselection(0) || distnation.setselection(0)) {              message = "select 4 fields, please..";             toast.maketext(busarrivaltime.this, message, toast.length_short).show();          } 

try this.

if (wilayat.getselecteditemposition() == 0 || city.getselecteditemposition() == 0 || station.getselecteditemposition() == 0 || distnation.getselecteditemposition() == 0) {         message = "select 4 fields, please..";         toast.maketext(busarrivaltime.this, message, toast.length_short).show(); } 

just use getselecteditemposition() method.

you make sure wilayatcity , on spinner.

add judgement

if (wilayat != null || city != null || station != null || distnation != null) {     // } 

Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -