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
Contributor
Posts: 11
Registered: ‎06-24-2009
My Device: Storm 2
My Carrier: Verizon
Accepted Solution

FieldChangeListener -- should work but it doesn't

 

public class TestDynamicMenus extends MainScreen implements FieldChangeListener {
	ButtonField btOK;
	public TestDynamicMenus () {
		ButtonField btOK = new ButtonField ("OK", ButtonField.CONSUME_CLICK);
		btOK.setChangeListener(this);
		add(btOK);
	}
	
	public void fieldChanged(Field field, int context) {
		if (field == btOK){
			Dialog.inform("Hi");
			}
	}
}

 

This drives me crazy -- the button shows in the simulator, but nothing happens when I push it. WHat am I doing wrong?!

 

---------------------------------------------------------------------------
Eclipse 1.2 -- BB Java plug-in 1.1.2 -- BB Java SDK 6
Developer
Posts: 374
Registered: ‎04-07-2010
My Device: Bold 9000
My Carrier: Airtel

Re: FieldChangeListener -- should work but it doesn't

[ Edited ]

Hi,

Just Change:

ButtonField btOK = new ButtonField ("OK", ButtonField.CONSUME_CLICK);

to

btOK = new ButtonField ("OK", ButtonField.CONSUME_CLICK);

Press the Like button (Thumb up) on the left side to thank and
please mark the Thread as solved if its solved...
K.S
Contributor
Posts: 11
Registered: ‎06-24-2009
My Device: Storm 2
My Carrier: Verizon

Re: FieldChangeListener -- should work but it doesn't

Great. thanks!

---------------------------------------------------------------------------
Eclipse 1.2 -- BB Java plug-in 1.1.2 -- BB Java SDK 6