This Example goes to create a Phone Book MIDlet
This example illustrates how to create your phone book. In this example we are taking three SCREEN button ("Next", "New", "Exit") and taking two TextBox ("name", "number"). In the name field user enters name and in number field user enters phone number. When user enters name and click on Next button then number text box will open, now user enters phone number. In case user select "Exit" or "New" the name and number get prints on the console.
When program will run initially, startApp() method will be called. And both "Enter Name" text box and the "Next" button will be displayed. After that if user clicks on next button the commandAction() method will be called that will check, if label is equal to "Next" then number TextBox will appear on the screen that can be used to enter the phone number of user.
The application display as below:
Source code of PhoneBookExample.java
Liked it! Share this Tutorial