Thursday, 15 April 2010

java - Verify that every button is clicked -



java - Verify that every button is clicked -

when button in column clicked, displays either "0" , "1". i'd verify buttons clicked via submit button. code works, however, if first button in column has value in it, next buttons aren't verified.

if (id==r.id.submit){ for(int i=0; i<cola.length; ){ if (((cola[i].gettext()==("0"))) || ((cola[i].gettext()==("1")))){ break; } else{ system.out.println("please come in values column a."); break; } } }

you can create counter such this, count number of buttons clicked , match total number of buttons clicked in column

if (id==r.id.submit){ int counter=0; for(int i=0; i<cola.length; i++ ){ if (((cola[i].gettext()==("0"))) || ((cola[i].gettext()==("1")))){ counter++; } } if(counter==cola.length){ //all have been clicked } else{ system.out.println("please come in values column a."); } }

java button click verify

No comments:

Post a Comment