Mobile Application Development JEDI Chapter 2
-
Upload
alver-noquiao -
Category
Documents
-
view
827 -
download
3
description
Transcript of Mobile Application Development JEDI Chapter 2
![Page 1: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/1.jpg)
Mobile Application Development 1
02 Getting Started with Mobile Programming
![Page 2: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/2.jpg)
Mobile Application Development 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
![Page 3: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/3.jpg)
Mobile Application Development 3
Getting Started
●“Hello, World!” MIDlet
●Using Netbeans and Mobility Pack
![Page 4: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/4.jpg)
Mobile Application Development 4
MIDlet Life Cycle
Active
Paused
Destroyed
destroyApp()
destroyApp()
startApp()
pauseApp()
new
![Page 5: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/5.jpg)
Mobile Application Development 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;
![Page 6: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/6.jpg)
Mobile Application Development 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);
}
![Page 7: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/7.jpg)
Mobile Application Development 7
Hello, world! MIDlet public void startApp() {
if (display == null){
display = Display.getDisplay(this);
}
display.setCurrent(helloAlert);
}
![Page 8: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/8.jpg)
Mobile Application Development 8
Hello, world! MIDlet public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
![Page 9: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/9.jpg)
Mobile Application Development 9
Hello, world! MIDlet public void commandAction(Command c, Displayable d){
if (c == exitCommand){
notifyDestroyed(); // Exit
}
}
![Page 10: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/10.jpg)
Mobile Application Development 10
Mobile Application Devt
●“Hello, World!” MIDlet
●Using Netbeans and Mobility Pack
![Page 11: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/11.jpg)
Mobile Application Development 11
Using Netbeans● Open Netbeans
● Create a Project
● Create a new MIDlet
● Compile and Run the MIDlet
![Page 12: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/12.jpg)
Mobile Application Development 12
Create a Project● File -> New Project
● Category: Mobile
● Project: Mobile Application
● Specify Project Name
● Select Platform
![Page 13: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/13.jpg)
Mobile Application Development 13
Create a Project
![Page 14: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/14.jpg)
Mobile Application Development 14
Create a MIDlet● File -> New File...
● Category: MIDP
● File Type: MIDlet
● Specify MIDlet Name
● Write the MIDlet code
![Page 15: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/15.jpg)
Mobile Application Development 15
Create a MIDlet
![Page 16: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/16.jpg)
Mobile Application Development 16
Create a MIDlet
![Page 17: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/17.jpg)
Mobile Application Development 17
Specify the MIDlet's name
![Page 18: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/18.jpg)
Mobile Application Development 18
Write the MIDlet Code
![Page 19: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/19.jpg)
Mobile Application Development 19
CompileandRunthe
MIDlet
![Page 20: Mobile Application Development JEDI Chapter 2](https://reader035.fdocuments.in/reader035/viewer/2022062216/558fd0b81a28ab451b8b46d8/html5/thumbnails/20.jpg)
Mobile Application Development 20
Summary
●“Hello, World!” MIDlet
●Using Netbeans and Mobility Pack