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
Highlighted
Developer
Posts: 53
Registered: ‎01-12-2011
My Device: BOLD 9780
My Carrier: Bharti Airtel
Accepted Solution

BitmapField FieldChangeListener problem

Hi

I am using BitmapField as a button with both FieldChangeListener and

FocusChangeListener in my app.

In FocusChangeListener I am just changing image of bitmapfield

and in FieldChangeListener i gave one action.

Problem is when BitmapField gained focus, FieldChangeListener gets invoked

What could be the solution to prevent this?

I want action to be invoked only on Click and not on FOCUS_GAINED event

Developer
Posts: 263
Registered: ‎10-27-2010
My Device: 8520

Re: BitmapField FieldChangeListener problem

Hi,

 

Instead of Field change listener try with 'navigation on click ' method.....

 

 

 

 

 

 

 

 

 

 

 

----------------------------------------------------------------------------------------------------------------------------------------------------------

press 'Kudos'   if it helps

 

Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

Re: BitmapField FieldChangeListener problem

Hi,

 

try this code

 

 

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;
  }
};

 

---------------------------------------------------------------------------------------------------------------------------------------------------------
feel free to press the kudos button  on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.

 

Developer
Posts: 16,786
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: BitmapField FieldChangeListener problem

in your fieldchangelistener you can check for PROGRAMMATIC, this allows you to discern between user actions (click) and program actions (bitmap change)
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 53
Registered: ‎01-12-2011
My Device: BOLD 9780
My Carrier: Bharti Airtel

Re: BitmapField FieldChangeListener problem

Thanx all of you

Everybody's solution is working for me..