List of all Iphone and Blackberry Development codes in a one click Iphone,objective C,xcode,blackberry Development,iOS Development

Thursday, June 27, 2013

Navigation events in Blackberry

You can use the Screen navigation methods to create a BlackBerry device application. If your existing BlackBerry device application implements the TrackwheelListener interface, update your BlackBerry device application to use the Screen navigation methods.
navigationClick(int status, int time)
navigationUnclick(int status, int time)
navigationMovement(int dx, int dy, int status, int time)
 
Navagation Click - 
public boolean navigationClick(int status, int time) {
   if ((status & KeypadListener.STATUS_TRACKWHEEL) == KeypadListener.STATUS_TRACKWHEEL) {
      //Input came from the trackwheel
   } else if 
     ((status & KeypadListener.STATUS_FOUR_WAY) == KeypadListener.STATUS_FOUR_WAY) {
      //Input came from a four way navigation input device 
   }
   return super.navigationClick(status, time);
}
 
Touch Event - 
protected boolean touchEvent(TouchEvent message) {
switch(message.getEvent()) {
    case TouchEvent.CLICK:
    Dialog.alert("A click action occurred");
    return true;

case TouchEvent.DOWN:
    Dialog.alert("A down action occurred");
    return true;

case TouchEvent.MOVE:
    Dialog.alert("A move action occurred");
    return true;
}

return false;
} 

Respond to a user touching the screen twice quickly -

protected boolean touchEvent(TouchEvent message) {
   switch(message.getEvent()) {
      case TouchEvent.GESTURE:
         TouchGesture gesture = message.getGesture();
         switch(gesture.getEvent()) {
            case TouchGesture.TAP:
               if(gesture.getTapCount() == 2) {
                  Dialog.alert("Double tap occurred");
                  return true;
               }
          }
   }
 return false;
}   

 Pinch gestures -

Enabling Pinch event - 
InputSettings ts = TouchscreenSettings.createEmptySet();
ts.set(TouchscreenSettings.DETECT_PINCH, 1);
addInputSettings(ts); 
 
protected boolean touchEvent(TouchEvent message) 
{
   switch(message.getEvent()) 
   {
      case TouchEvent.GESTURE:
         TouchGesture gesture = message.getGesture();
         switch(gesture.getEvent()) 
         {
           case TouchGesture.PINCH_END:
             Dialog.alert("Focal point: " + message.getX(1) 
             +            ", " + message.getY(1)
             +            "\nFinal zoom value: " + gesture.getPinchMagnitude());
             return true;
         }
   }
   return false;
}

No comments:

Post a Comment