Android - Array or for statement problem
Posted
by Normano
on Stack Overflow
See other posts from Stack Overflow
or by Normano
Published on 2010-04-03T22:57:52Z
Indexed on
2010/04/03
23:03 UTC
Read the original article
Hit count: 215
android
I making on a app, but I have a problem with for or with a array. When I use this code
case MotionEvent.ACTION_MOVE:
for (int i = 0; i < Button.length; i++) {
if (Y > Button[i].getTop()+25 && Y < Button[i].getBottom()+25 && X > Button[i].getLeft() && X < Button[i].getRight()){
LastButton = i;
edittext.setText("id " + i);
}
}
break;
But the for statement skip the first button in the array and the second button get id 1. anyone know how I can fix it? Thanks
© Stack Overflow or respective owner