2010-07-14 67 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