Sunday, 9 June 2013

Displaying Messages Using Alert in Nokia Apps

Displaying Alert Message in Nokia Apps

asha mobile application

Here we coded a sample app for displaying alert messages in Nokia lcdui app.Alert messages are one which are used mostly in cases like Alarm,Confirmations,Error messages etc.

Creating Alert is very easy one in lcdui apps.The syntax is simple as given below

To create an Alert in LCUDI:

Alert alert=new Alert("I am a Alert");

You can even set the timeout property to set the timing for how long the alert should be displayed to the user.

To set timeout property for Alert:

Alert alert=new Alert("I am a Alert");

You should enter the timeout in microseconds only.
Finally you have to add the Alert to current display otherwise it wont be displayed.

To add Alert to Display:


Sample code:

Here we create a complete sample code for Alert

In this code we implemented in such a way that when you click on command button you will get a Alert message in screen

import javax.microedition.lcdui.Alert;

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.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class Alert_Sample extends MIDlet implements CommandListener {

Display display;
Command ok;
public Alert_Sample() {
// TODO Auto-generated constructor stub

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub


protected void pauseApp() {
// TODO Auto-generated method stub


protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
Form a=new Form("Alert Sample");
ok= new Command("Calculate", Command.SCREEN, 1);

public void commandAction(Command arg0, Displayable arg1) {
// TODO Auto-generated method stub
Alert alert=new Alert("I am a Alert");


You will get output resemble the below picture

asha mobile application

Any doubts please be free to ask in the comment we are eager to help you.You can also post your help in our FB group


  1. This is quite important article for me because I was searching the same thing what you have posted. Now I will easily download this application... Thanks for posting.
    mobile event app

  2. Prarthana Packers and Movers understand that shifting your household goods can be worrisome as you have an attachment to them.
    Packers and movers in Ernakulam