In this "Alert Message" example, you will learn how to send an alert message to user whenever an action is called. The example have two different options 1. "ok" and option 2. "Cancel". If user choose the option one "ok" showMsg() method will be called but in case of choosing option two "Cancel" the tryAgain() method will be called.
An alert is a screen that shows message
to the user and waits for a given period of time before proceeding to the next Displayable.
An alert can contain a text string or an image.
Alert(java.lang.String title):- This is used to build new, empty Alert objects with the given title.
Alert(java.lang.Stringtitle, java.lang.StringalertText, javax.microedition.lcdui.ImagealertImage, javax.microedition.lcdui.AlertTypealertType):- we are using this to construct a new Alert object with the given title, content title, string and image, and alert type.
Alert(java.lang.String title, java.lang.String alertText, javax.microedition.lcdui.Image alertImage, javax.microedition.lcdui.AlertType alertType, Style style):- This Constructs a new Alert object with the given title, content string and image, and alert type.
Alert(java.lang.String title, Style style):- Used to create a new, empty Alert object with the given title.
The Alert class have following methods:



Source Code of AlertExample .java
import javax.microedition.midlet.MIDlet;
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: A MIDlet Example to execute Alert Message with an Image
Post your Comment