I'm developing an application on 9900 where both Trackball and touch screen are available.
In my application, I have a screen which contains two buttons, the strange behavior is that:
If I set the focus using the trackball to the second button, and then I touch any empty location in the screen, the change listener of the second button get fired ? I want nothing to happen if the user wrongly clicks empty space and doesn't touch the second button, how to do this ?
Asked
Active
Viewed 97 times
2

Ashraf Bashir
- 9,686
- 15
- 57
- 82
-
Please post the code you use for this screen with two buttons. Thanks. – Nate Oct 09 '12 at 01:06
1 Answers
0
I solved it, for those who are interested, you may use this code in your Image button class:
private boolean isTouchOutside;
protected boolean touchEvent(TouchEvent message) {
isTouchOutside = message.getX(1) < 0 || message.getX(1) > getWidth() || message.getY(1) < 0 || message.getY(1) > getHeight();
return super.touchEvent(message);
}
protected boolean navigationClick(int status, int time) {
if(! isTouchOutside)
fieldChangeNotify(0);
return true;
}

Ashraf Bashir
- 9,686
- 15
- 57
- 82