This example illustrates how to create command button in your form. Command class build to bind only the semantic information of the command it means command is not the actual action its contains only information about command. Command action is defined in CommandListener class with associated screen or form. Command contains three methods:
the label contains label of the commands, the type contains types of the command and the priority contains priority of the commands.
List of the Command Field:
For more, see the following example:

If user select the 'BACK' command then the commandAction() function will be called and check whether label is equal to 'BACK' then backCom() function will be called and display the form with alert object ('BACK Command') screen displays as below:

or when select the OK command the 'OK Command' will be displayed:

Source code of CommandExample.java
import javax.microedition.lcdui.*;
|
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: Command Midlet Example View All Comments
Post your Comment