SlideShare a Scribd company logo
1 of 20
02 Getting Started with
  Mobile Programming



      Mobile Application Development   1
Objectives
At 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
Getting Started
●
    “Hello, World!” MIDlet

●
    Using Netbeans and Mobility Pack




                Mobile Application Development   3
MIDlet Life Cycle
                new

                          destroyApp()




startApp()     Paused


                                           Destroyed
               Active         pauseApp()




                         destroyApp()




               Mobile Application Development          4
Hello, world! MIDlet
import 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
Hello, world! MIDlet
public 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
Hello, world! MIDlet
public void startApp() {
    if (display == null){
        display = Display.getDisplay(this);
    }


    display.setCurrent(helloAlert);
}




            Mobile Application Development    7
Hello, world! MIDlet
public void pauseApp() {
}


public void destroyApp(boolean unconditional) {
}




            Mobile Application Development        8
Hello, world! MIDlet
public void commandAction(Command c, Displayable d){
    if (c == exitCommand){
         notifyDestroyed(); // Exit
    }
}




              Mobile Application Development           9
Mobile Application Devt
●
    “Hello, World!” MIDlet

●
    Using Netbeans and Mobility Pack




                  Mobile Application Development   10
Using Netbeans
●
    Open Netbeans

●
    Create a Project

●
    Create a new MIDlet

●
    Compile and Run the MIDlet




                       Mobile Application Development   11
Create a Project
●
    File -> New Project

●
    Category: Mobile

●
    Project: Mobile Application

●
    Specify Project Name

●
    Select Platform




                      Mobile Application Development   12
Create a Project




  Mobile Application Development   13
Create a MIDlet
●
    File -> New File...

●
    Category: MIDP

●
    File Type: MIDlet

●
    Specify MIDlet Name

●
    Write the MIDlet code




                     Mobile Application Development   14
Create a MIDlet




 Mobile Application Development   15
Create a MIDlet




 Mobile Application Development   16
Specify the MIDlet's name




       Mobile Application Development   17
Write the MIDlet Code




     Mobile Application Development   18
Compile
  and
  Run
  the
 MIDlet


          Mobile Application Development   19
Summary
●
    “Hello, World!” MIDlet

●
    Using Netbeans and Mobility Pack




                  Mobile Application Development   20

More Related Content

Similar to Mobile Application Development JEDI Chapter 2

Putting real feeling into Android Apps
Putting real feeling into Android AppsPutting real feeling into Android Apps
Putting real feeling into Android AppsPeter van der Linden
 
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...Bala Subra
 
Android studio
Android studioAndroid studio
Android studioAndri Yabu
 
Basics of Android
Basics of Android Basics of Android
Basics of Android sabi_123
 
Native vs Hybrid - Options to develop your mobile application
Native vs Hybrid - Options to develop your mobile applicationNative vs Hybrid - Options to develop your mobile application
Native vs Hybrid - Options to develop your mobile applicationLoic Ortola
 
Android On Your Sleeve - DroidCon Montreal 2015
Android On Your Sleeve - DroidCon Montreal 2015Android On Your Sleeve - DroidCon Montreal 2015
Android On Your Sleeve - DroidCon Montreal 2015Neal Sanche
 
Android Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docxAndroid Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docxkarthikaparthasarath
 
Android presentation
Android presentationAndroid presentation
Android presentationImam Raza
 
GRIN Global Mobile App, Android and Windows 10
GRIN Global Mobile App, Android and Windows 10GRIN Global Mobile App, Android and Windows 10
GRIN Global Mobile App, Android and Windows 10Edwin Rojas
 
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...IJCNCJournal
 
Android Development
Android DevelopmentAndroid Development
Android DevelopmentPaulo Hecht
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applicationsTOPS Technologies
 
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a NutshellAleix Solé
 
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTFMobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTFNiklas Heidloff
 

Similar to Mobile Application Development JEDI Chapter 2 (20)

Putting real feeling into Android Apps
Putting real feeling into Android AppsPutting real feeling into Android Apps
Putting real feeling into Android Apps
 
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
Mobile Development Architecture Ppt with Slides, Book Notes on using Web Silv...
 
Android studio
Android studioAndroid studio
Android studio
 
Getting started with android studio
Getting started with android studioGetting started with android studio
Getting started with android studio
 
Basics of Android
Basics of Android Basics of Android
Basics of Android
 
200810 - iPhone Tutorial
200810 - iPhone Tutorial200810 - iPhone Tutorial
200810 - iPhone Tutorial
 
Native vs Hybrid - Options to develop your mobile application
Native vs Hybrid - Options to develop your mobile applicationNative vs Hybrid - Options to develop your mobile application
Native vs Hybrid - Options to develop your mobile application
 
Android On Your Sleeve - DroidCon Montreal 2015
Android On Your Sleeve - DroidCon Montreal 2015Android On Your Sleeve - DroidCon Montreal 2015
Android On Your Sleeve - DroidCon Montreal 2015
 
Android Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docxAndroid Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docx
 
Android presentation
Android presentationAndroid presentation
Android presentation
 
Mobile Web vs. Native Apps
Mobile Web vs. Native AppsMobile Web vs. Native Apps
Mobile Web vs. Native Apps
 
GRIN Global Mobile App, Android and Windows 10
GRIN Global Mobile App, Android and Windows 10GRIN Global Mobile App, Android and Windows 10
GRIN Global Mobile App, Android and Windows 10
 
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
AN IDE FOR ANDROID MOBILE PHONES WITH EXTENDED FUNCTIONALITIES USING BEST DEV...
 
Android Development
Android DevelopmentAndroid Development
Android Development
 
How to create android applications
How to create android applicationsHow to create android applications
How to create android applications
 
01 07 -android programming basics (cont)
01  07 -android programming basics (cont)01  07 -android programming basics (cont)
01 07 -android programming basics (cont)
 
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a Nutshell
 
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTFMobile Controls for IBM Lotus Domino XPages on OpenNTF
Mobile Controls for IBM Lotus Domino XPages on OpenNTF
 
Android setup
Android setupAndroid setup
Android setup
 
Synapseindia android apps application
Synapseindia android apps applicationSynapseindia android apps application
Synapseindia android apps application
 

Mobile Application Development JEDI Chapter 2

  • 1. 02 Getting Started with Mobile Programming Mobile Application Development 1
  • 2. Objectives At 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. Getting Started ● “Hello, World!” MIDlet ● Using Netbeans and Mobility Pack Mobile Application Development 3
  • 4. MIDlet Life Cycle new destroyApp() startApp() Paused Destroyed Active pauseApp() destroyApp() Mobile Application Development 4
  • 5. Hello, world! MIDlet import 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. Hello, world! MIDlet public 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. Hello, world! MIDlet public void startApp() { if (display == null){ display = Display.getDisplay(this); } display.setCurrent(helloAlert); } Mobile Application Development 7
  • 8. Hello, world! MIDlet public void pauseApp() { } public void destroyApp(boolean unconditional) { } Mobile Application Development 8
  • 9. Hello, world! MIDlet public void commandAction(Command c, Displayable d){ if (c == exitCommand){ notifyDestroyed(); // Exit } } Mobile Application Development 9
  • 10. Mobile Application Devt ● “Hello, World!” MIDlet ● Using Netbeans and Mobility Pack Mobile Application Development 10
  • 11. Using Netbeans ● Open Netbeans ● Create a Project ● Create a new MIDlet ● Compile and Run the MIDlet Mobile Application Development 11
  • 12. Create a Project ● File -> New Project ● Category: Mobile ● Project: Mobile Application ● Specify Project Name ● Select Platform Mobile Application Development 12
  • 13. Create a Project Mobile Application Development 13
  • 14. Create a MIDlet ● File -> New File... ● Category: MIDP ● File Type: MIDlet ● Specify MIDlet Name ● Write the MIDlet code Mobile Application Development 14
  • 15. Create a MIDlet Mobile Application Development 15
  • 16. Create a MIDlet Mobile Application Development 16
  • 17. Specify the MIDlet's name Mobile Application Development 17
  • 18. Write the MIDlet Code Mobile Application Development 18
  • 19. Compile and Run the MIDlet Mobile Application Development 19
  • 20. Summary ● “Hello, World!” MIDlet ● Using Netbeans and Mobility Pack Mobile Application Development 20