how to get a field press event in blackberry [closed]

此生再无相见时 提交于 2019-12-13 03:55:29

问题


how to get a field press event in blackberry。

I write a component extends Field class , want to get a press event( press down still not press up ) .

please help me.


回答1:


You can override this method:

protected boolean keyDown(int keycode, int time) 

About the key up presses, there's a keyUp which is the method you should override to perform an action when the key is released instead of pressed (you can press and hold, and the action doesn't normally get fired until released). However, the OS doesn't callback on key up events unless it is explicitly told to do so by your app, for performance reasons.




回答2:


You can overide keydown method of any field variable , or you can override navigationClick method of click

 public ButtonField btn = new ButtonField("Hello");
 protected boolean navigationClick(int status, int time)
 {
     Field f1 = getFieldWithFocus().getLeafFieldwithFocus()
     if(f1 == btn)
     {
        <Perform your business logics>
     }

Thanks



来源:https://stackoverflow.com/questions/11759289/how-to-get-a-field-press-event-in-blackberry

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!