0

I am doing a blackberry, in my application I have to make a bitmapfield clickable and focusable .This is my samplecode.

 bf=new BitmapField(logo,BitmapField.FOCUSABLE){
 protected boolean navigationClick(int status, int time) {
 Dialog.inform("haaaaaaaaaaaai");
 return true;
  };
 protected void layout(int width, int height) {
            // TODO Auto-generated method stub
            super.layout(width, height);
            setExtent(120, 110);
        }
};

And I added this field to a verticalfieldmanager. Now the problem is if I click any where in the screen the action is happening and it is not showing any sign of focus.Please help me friends.

sarath
  • 157
  • 1
  • 2
  • 7
  • 2
    possible duplicate of [Image Button in BlackBerry](http://stackoverflow.com/questions/2912223/image-button-in-blackberry) – Michael Donohue Nov 23 '11 at 06:21
  • http://stackoverflow.com/questions/2912223/image-button-in-blackberry refer this question.. Before asking any question please search it on this site. – V.J. Nov 23 '11 at 09:34

3 Answers3

0

For making the bitmap field focusable and clickable yue just use this code:-

Bitmap myBitmap = Bitmap.getBitmapResource("image.png");

    BitmapField icImg = new BitmapField(myBitmap, BitmapField.FOCUSABLE)
    {
      protected boolean navigationClick(int status, int time) 
        {

          UiApplication.getUiApplication().pushScreen( new SCREENCLASS());
               return true;
         }
    };
add(icImg)
Amit_T
  • 149
  • 11
0

BitmapField caontains Bitmap, so blue focusable rectangle covered by bitmap. If you want to show the BitmapField focusable then you need to:

  1. use low opacity image. OR
  2. use image with 2 or more pixel transparent padding around the image.

for the second issue use can add NullField before the BitmapField because by default first field have focus in screen. And in your case only one field available on screen.

Vivek Kumar Srivastava
  • 2,158
  • 1
  • 16
  • 23
0

Check at Advanced UI. And look for BitmapButton. :)

BB UI Pro.
  • 51
  • 1