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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
WesleyT
Posts: 206
Registered: ‎07-02-2010
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.

Please use plain text.
Developer
simon_hain
Posts: 13,830
Registered: ‎07-29-2008
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
Please use plain text.
Developer
WesleyT
Posts: 206
Registered: ‎07-02-2010
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 :smileysad:

Please use plain text.
Developer
WesleyT
Posts: 206
Registered: ‎07-02-2010
My Carrier: Vodacom

Re: ObjectChoiceField ChangeListener ?

Doesn'y anyone else have any suggestions ?

 

Regards

Please use plain text.
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
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?

 

 

Please use plain text.
Developer
WesleyT
Posts: 206
Registered: ‎07-02-2010
My Carrier: Vodacom

Re: ObjectChoiceField ChangeListener ?

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

Please use plain text.
Developer
WesleyT
Posts: 206
Registered: ‎07-02-2010
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

Please use plain text.
Administrator
MSohm
Posts: 12,957
Registered: ‎07-09-2008
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.
Found a bug? Report it using the Issue Tracker
Please use plain text.