Advance Thanks.i am new to blackberry developement.i try the following code for creating alert using lcdui package.but nothing will coming when i am running
Plz help me.
package alertpack;
import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.AlertType; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.Screen; import javax.microedition.midlet.MIDlet; import javax.microedition.midlet.MIDletStateChangeException;
import net.rim.device.api.ui.Color; import net.rim.device.api.ui.Graphics;
public class alertclass extends MIDlet implements CommandListener {
private Display display;
private Alert alert;
private Form form = new Form("Throw Exception");
private Command exit = new Command("Exit", Command.SCREEN, 1);
private boolean exitFlag = false;
public alertclass(){ display = Display.getDisplay(this); form.addCommand(exit); form.setCommandListener(this); }
protected void destroyApp(boolean unconditional) throws MIDletStateChangeException { // TODO Auto-generated method stub if (unconditional == false) { throw new MIDletStateChangeException(); }
}
protected void pauseApp() { // TODO Auto-generated method stub
}
protected void startApp() throws MIDletStateChangeException { // TODO Auto-generated method stub display.setCurrent(form);
}
public void commandAction(Command c, Displayable d) { // TODO Auto-generated method stub
if (c == exit) { try { if (exitFlag == false) { alert = new Alert("Busy", "Please try again.", null, AlertType.WARNING); alert.setTimeout(Alert.FOREVER); display.setCurrent(alert, form); destroyApp(false); } else { destroyApp(true); notifyDestroyed(); } } catch (Exception exception) { exitFlag = true; } }
}
}