Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Regular Contributor
Posts: 54
Registered: ‎05-04-2011
My Device: 1
My Carrier: developer

Bitmapfield focus

Hi friends, i am using Bitmapfield ,i want to get focus on bitmapfield but i am not getting focus on bitmapfield...plz help me.  below is my code,

 

  Bitmap bm_music = null;
        BitmapField bmf_music = new BitmapField( bm_music,BitmapField.FOCUSABLE)
        {
           
            public boolean trackwheelClick(int status, int time){
            UiApplication.getUiApplication().pushScreen(new EventsList());
            return true;
            }
         };
         bm_music= PNGEncodedImage.getEncodedImageResource("img/musicicon.png").getBitmap();
         bmf_music.setBitmap(bm_music);

santhanam
Developer
Posts: 98
Registered: ‎08-17-2010
My Device: BlackBerry 8300 simulator
My Carrier: Vodafone

Re: Bitmapfield focus

Hello sankrish,
Please provide more details about your code, Did image is showing on Screen and not Focusable. Please try navigationMovement ro navibationClick for this. And Debug your code for the same.
Thanks

 

Regards,
Ajit Sharma
Regular Contributor
Posts: 54
Registered: ‎05-04-2011
My Device: 1
My Carrier: developer

Re: Bitmapfield focus

yes..my images are displaying on screen..but it is not focused.

santhanam
Developer
Posts: 202
Registered: ‎04-19-2011
My Device: Blackberry Bold 9780
My Carrier: TAM

Re: Bitmapfield focus

hmm... this is just my suggestion, try to implement fieldChangeListener in your screen :

 

Bitmap bm_music = PNGEncodedImage.getEncodedImageResource("img/musicicon.png").getBitmap();

BitmapField bmf_music = new BitmapField(bm_music,BitmapField.FOCUSABLE);
bmf.setChangeListener(this);

 then, use public void fieldchanged

public void fieldChanged(Field field, int context) {
  if (field instanceof BitmapField )
  {
     UiApplication.getUiApplication().pushScreen(new EventsList());
  }
}

 

Regular Contributor
Posts: 54
Registered: ‎05-04-2011
My Device: 1
My Carrier: developer

Re: Bitmapfield focus

[ Edited ]

nelson i tried that, its not working.

santhanam
Regular Contributor
Posts: 54
Registered: ‎05-04-2011
My Device: 1
My Carrier: developer

Re: Bitmapfield focus

i tried it,its not working.

santhanam
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Bitmapfield focus

Its not working is not a very useful problem description is it?

 

Here is the real question.  How do you expect your BitmapField to show that it is in focus?

 

I think you will find this KB article useful:

http://supportforums.blackberry.com/t5/Java-Development/Show-focus-changes-using-BitmapField/ta-p/44...

Developer
Posts: 98
Registered: ‎08-17-2010
My Device: BlackBerry 8300 simulator
My Carrier: Vodafone

Re: Bitmapfield focus

Did you try to overwrite paint method.

Try to print some message if this is in focus or clicked.

Regards,
Ajit Sharma
New Contributor
Posts: 7
Registered: ‎03-31-2011
My Device: 9800
My Carrier: Rogers

Re: Bitmapfield focus

How are you determining that the BitmapField is not focusable and the problem isn't somewhere else?

From the code you presented, I take it that you want a new screen to appear when you click on that image. I wonder if applying pushScreen(new EventsList()) or some other code is generating an exception and you are catching the exception, causing the error message to be absorbed and no change to the screen to be made? I can only guess from the code you've presented.

If the solution doesn't present itself the best thing to do is run the debugger.

 

Scott

Developer
Posts: 202
Registered: ‎04-19-2011
My Device: Blackberry Bold 9780
My Carrier: TAM

Re: Bitmapfield focus

Hm.... i think, you have to try debug it...

Then you will know, is your bitmapfield already been triggered when you click it...