Mobile Application Development JEDI Chapter 2

944 views
868 views

Published on

Mobile Application Development

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
944
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
33
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Mobile Application Development JEDI Chapter 2

  1. 1. 02 Getting Started with Mobile Programming Mobile Application Development 1
  2. 2. ObjectivesAt the end of the lesson, the student should be able to:● Create a simple MIDlet● Create a Project in Netbeans● Create a MIDlet in Netbeans● Run a MIDlet on the emulator Mobile Application Development 2
  3. 3. Getting Started● “Hello, World!” MIDlet● Using Netbeans and Mobility Pack Mobile Application Development 3
  4. 4. MIDlet Life Cycle new destroyApp()startApp() Paused Destroyed Active pauseApp() destroyApp() Mobile Application Development 4
  5. 5. Hello, world! MIDletimport javax.microedition.midlet.*;import javax.microedition.lcdui.*;public class HelloMidlet extends MIDlet implements CommandListener { Display display; Command exitCommand = new Command("Exit", Command.EXIT, 1); Alert helloAlert; Mobile Application Development 5
  6. 6. Hello, world! MIDletpublic HelloMidlet(){ helloAlert = new Alert( "Hello MIDlet", "Hello, world!", null, AlertType.INFO ); helloAlert.setTimeout(Alert.FOREVER); helloAlert.addCommand(exitCommand); helloAlert.setCommandListener(this); } Mobile Application Development 6
  7. 7. Hello, world! MIDletpublic void startApp() { if (display == null){ display = Display.getDisplay(this); } display.setCurrent(helloAlert);} Mobile Application Development 7
  8. 8. Hello, world! MIDletpublic void pauseApp() {}public void destroyApp(boolean unconditional) {} Mobile Application Development 8
  9. 9. Hello, world! MIDletpublic void commandAction(Command c, Displayable d){ if (c == exitCommand){ notifyDestroyed(); // Exit }} Mobile Application Development 9
  10. 10. Mobile Application Devt● “Hello, World!” MIDlet● Using Netbeans and Mobility Pack Mobile Application Development 10
  11. 11. Using Netbeans● Open Netbeans● Create a Project● Create a new MIDlet● Compile and Run the MIDlet Mobile Application Development 11
  12. 12. Create a Project● File -> New Project● Category: Mobile● Project: Mobile Application● Specify Project Name● Select Platform Mobile Application Development 12
  13. 13. Create a Project Mobile Application Development 13
  14. 14. Create a MIDlet● File -> New File...● Category: MIDP● File Type: MIDlet● Specify MIDlet Name● Write the MIDlet code Mobile Application Development 14
  15. 15. Create a MIDlet Mobile Application Development 15
  16. 16. Create a MIDlet Mobile Application Development 16
  17. 17. Specify the MIDlets name Mobile Application Development 17
  18. 18. Write the MIDlet Code Mobile Application Development 18
  19. 19. Compile and Run the MIDlet Mobile Application Development 19
  20. 20. Summary● “Hello, World!” MIDlet● Using Netbeans and Mobility Pack Mobile Application Development 20

×