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 wilayat
、city
, on spinner.
add judgement
if (wilayat != null || city != null || station != null || distnation != null) { // }
Comments
Post a Comment