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
Developer
Posts: 206
Registered: ‎07-02-2010
My Device: 8320 Curve
My Carrier: Vodacom

ObjectChoiceField ChangeListener ?

Hello,

 

I am using a FieldChangeListener to detect when an option has been selected in an ObjectChoiceField. This listener gets invoked twice on the focus and finally once selected.

How do I distinguish when the selection is complete ?

Here is the code that gets used:

class FieldListenerViewItem implements FieldChangeListener 
    {		
	public void fieldChanged(Field field, int context) 
	{
		try
		{					
		}
		catch (Exception e) 
		{
			Dialog.alert(e.toString());
		}
	}		
   }

 

Regards.

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

Re: ObjectChoiceField ChangeListener ?

check the context value

----------------------------------------------------------
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: 206
Registered: ‎07-02-2010
My Device: 8320 Curve
My Carrier: Vodacom

Re: ObjectChoiceField ChangeListener ?

Simon,

 

Thank you for your reply. I have checked the context value and it is 2 on both occasions. So that will not help me Smiley Sad

Developer
Posts: 206
Registered: ‎07-02-2010
My Device: 8320 Curve
My Carrier: Vodacom

Re: ObjectChoiceField ChangeListener ?

Doesn'y anyone else have any suggestions ?

 

Regards

Developer
Posts: 147
Registered: ‎08-27-2010
My Device: 9800
My Carrier: airtel

Re: ObjectChoiceField ChangeListener ?

[ Edited ]

I am trying to reproduce your problem but what i am getting is

for programatic change 

context = =PROGRAMMATIC

 

for focus change

context == 0

 

for selection

context == 2

 

and i think its a expected behavior.

which simulator or device you are getting context ==2 for both?

 

 

Highlighted
Developer
Posts: 206
Registered: ‎07-02-2010
My Device: 8320 Curve
My Carrier: Vodacom

Re: ObjectChoiceField ChangeListener ?

I am using the BB plugin for eclipse, And the 9550 Device on the simulator.

Developer
Posts: 206
Registered: ‎07-02-2010
My Device: 8320 Curve
My Carrier: Vodacom

Re: ObjectChoiceField ChangeListener ?

Vivart,

 

I have changed my simulator device to a 9700. On this model the context does in fact change and give me the correct values 0 == Focus 2 == selected. Do you have any idea as to why this is not the case for the 9550 ? Is this potentially a bug or does this have something to do with the touchscreen ?

 

Regards

BlackBerry Development Advisor
Posts: 15,696
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: ObjectChoiceField ChangeListener ?

I have logged this issue in the Issue Tracker here:  https://www.blackberry.com/jira/browse/JAVAAPI-1514

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker