黑莓中的箭头键问题

时间:2010-07-14 08:40:32

标签: blackberry

目前我正在开发黑莓应用程序,并且在这一点上坚持如何访问右箭头键和左箭头键来生成针对这些的事件。我会非常感谢你。

1 个答案:

答案 0 :(得分:1)

class LocationMain extends UiApplication {
  public LocationMain()
  {
      pushScreen(new LocTestScreen());
  }

  public static void main(String args[])
  {
      LocationMain app = new LocationMain();
      app.enterEventDispatcher();
  }
} 



 class LocTestScreen extends MainScreen {

  protected boolean navigationMovement(int dx, int dy, int status, int time) {
    if(dy < 0) 
        System.out.println("UP");
    if(dy > 0) 
        System.out.println("down");
    if(dx < 0) 
        System.out.println("left");
    if(dx > 0) 
        System.out.println("right");

    return false;
  }
}