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
New Contributor
Posts: 6
Registered: ‎05-20-2012
My Device: Storm
My Carrier: ATT&T
Accepted Solution

Button Click Show Dialog.Alert

[ Edited ]

Hello, I am new to Blackberry development and I cannot get a SIMPLE dialog.Alert to show on a button click.  Talk about the most frustrating programming I have ever done.  If someone would please help me I would appreciate it a whole lot!

 

ButtonField btnCalc = new ButtonField("Calculate", ButtonField.FIELD_LEFT | ButtonField.CONSUME_CLICK);
btnCalc.setPadding(0, 0, 0, 4);

FieldChangeListener customListener = new FieldChangeListener() {
public void fieldChanged(Field field, int context) {
Dialog.alert("Hello");

}
};

btnCalc.setChangeListener(customListener);

 

Developer
Posts: 209
Registered: ‎04-30-2011
My Device: BlackBerry Z10
My Carrier: Airtel

Re: Button Click Show Dialog.Alert

Hi

 

class pk extends MainScreen
{
pk()
{
	 
	ButtonField btnCalc = new ButtonField("Calculate", ButtonField.FIELD_LEFT | ButtonField.CONSUME_CLICK);
	btnCalc.setPadding(0, 0, 0, 4);

	FieldChangeListener customListener = new FieldChangeListener() {
	public void fieldChanged(Field field, int context) {
	Dialog.alert("Hello Pawan");
	}
	};

	btnCalc.setChangeListener(customListener);
	 add(btnCalc);
}
}

 

Its workying fine. I did test it. when you will click on button, you will get Dialog.alert.

 

Thanks
Pawan 

New Contributor
Posts: 6
Registered: ‎05-20-2012
My Device: Storm
My Carrier: ATT&T

Re: Button Click Show Dialog.Alert

I am not sure what happened.  I removed all the code, ran it, the app ran fine, then re-added the code and it was fine.

 

Interesting.  At least I dont feel as much like an **bleep** anymore.

 

Thanks