2010-07-14 41 views
1

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

回答

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; 
    } 
} 
+0

非常感谢您的帮助。 – Farhan 2010-07-14 12:42:07