android - Why are the onTouchEvent listeners in my buttonSprite Array returning all the same values? -


i've created array of spritebuttons touch listeners follows:

attackcursor.movetofirst(); while (attackcursor.isafterlast() == false) {        attackbuttons[attackbuttonscounter] = new buttonsprite(0, 0,         playermenu.getplayermenuattacktr(),         engine.getvertexbufferobjectmanager()) {          @override         public boolean onareatouched(touchevent pscenetouchevent,                                      float ptoucharealocalx,                                      float ptoucharealocaly) {              if (pscenetouchevent.isactiondown()) {                 beep.play();                 attacktype = cursor.getint(0);             }              return true;         }     };     attackbuttonscounter++; } 

when run way error message touch events. if replace cursor.getint(0) theattackbuttonscounter makes buttons have data of last run of loop. there problem inserting code onareatouch() when generated loop? know don't have @override above touch method. not cause sure. i'd appreciate pointers in right direction


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -