BlackBerry - Invoke a click event on bitmap Field

跟風遠走 提交于 2020-01-02 16:19:07

问题


can anyone help me for solving the below question. I am making an application for blackberry in that from one bitmapField i have to invoke a new screen by clicking on the bitmapField. I want the code for the same... how to invoke a new screen by clicking on a bitmapField... and i am using blackberry JDE 4.7


回答1:


Try making the BitmapField focusable

BitmapField bm = new BitmapField(bitmap, BitmapField.FOCUSABLE);

This might help




回答2:


BitmapField bmpField = new BitmapField(bitmap, BitmapField.FOCUSABLE)

   protected boolean navigationClick(int status, int time)
   {
      if(bmpField.isFocus)
      {
          UiApplication.getUiApplication().pushScreen(new MyScreen());
      }
      return true;
   }
}

i have used on a Storm and it works.

If even this does not work, u can go ahead and use touchEvent instead of navigationClick




回答3:


This must work

BitmapField bmpField = new BitmapField(bitmap, BitmapField.FOCUSABLE){

   protected void drawFocus(Graphics graphics, boolean on){
      //the simplies way to draw a rectangle and this will be the focus
   }                               

   protected boolean navigationClick(int status, int time)
   {
      //write here your code what you want to run the user clicks to the bitmap
      //try something like this
      UiApplication.getUiApplication().pushScreen(new MyScreen());
      return true;
   }
}


来源:https://stackoverflow.com/questions/2145163/blackberry-invoke-a-click-event-on-bitmap-field

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