06-22-2011 12:03 AM
Hi everyone,
I want to implement listener for UP, DOWN, LEFT, RIGHT trackwheel events. I'm using Keypad interface and in it's documentation it is said to override navigationClick this way:
public boolean navigationClick(int status, int time)
{
if ((status & KeypadListener.STATUS_TRACKWHEEL) == KeypadListener.STATUS_TRACKWHEEL)
{
}
else if ((status & KeypadListener.STATUS_FOUR_WAY) == KeypadListener.STATUS_FOUR_WAY)
{
}
return super.navigationClick(status, time);
}
But, how do I know the direction (right or left etc.)?
Solved! Go to Solution.
06-22-2011 12:21 AM - edited 06-22-2011 12:23 AM
navigationClick() triggers when a "click" occurs but doesn't detect left/right/up/down movement on the trackpad. If you want to detect movement, override navigationMovement() instead.
Scott
edit: PS - when the API refers to a "trackwheel", it is reffering the the roller wheel found on the older BB devices.
06-22-2011 12:26 AM
thanx, now it works.
The code I use is:
protected boolean navigationMovement(int dx, int dy, int status, int time) {
if(dx < 0 && dy == 0) {
System.out.println("______________________________ ________LEFT");
} else if(dx > 0 && dy == 0) {
System.out.println("______________________________ ________RIGHT");
} else if(dx == 0 && dy > 0) {
System.out.println("______________________________ ________DOWN");
} else if(dx == 0 && dy < 0) {
System.out.println("______________________________ ________UP");
}
return true;
}