J2ME MIDP2.0 - PowerPoint PPT Presentation

1 / 29
About This Presentation
Title:

J2ME MIDP2.0

Description:

... samsungmobile.com/eng/front_zone/bbs/bbs_main.jsp?p_menu_id=1500 ... Forum Nokia. Orange. Sony Ericsson. Motorola. Sun J2ME. Several others available... – PowerPoint PPT presentation

Number of Views:190
Avg rating:3.0/5.0
Slides: 30
Provided by: supe85
Category:
Tags: j2me | bbs | midp2 | sun

less

Transcript and Presenter's Notes

Title: J2ME MIDP2.0


1
J2ME MIDP2.0
  • An Introduction

2
What is J2ME?
  • Java 2 Micro Edition
  • Specially cut down version of Java for mobile
    devices, such as mobile phones, PDAs, Set Top
    Boxes.
  • It combines a resource-constrained JVM (Java
    Virtual Machine) and a set of Java APIs for
    developing applications for mobile devices.

3
What is J2ME?
  • In CLDC, many features such as floating-point
    support are missing, due to capabilities of the
    device.
  • Extra features such as a GameAPI are now included
    for mobile development.
  • Unlike windows, a java virtual machine comes
    pre-installed on the phone.

4
Why J2ME?
  • Supported by over 1Billion handsets
  • Device independent

5
J2ME Development
  • Sun Wireless Toolkit WTK
  • Several IDEs Available
  • NetBeans
  • Eclipse
  • Sun One
  • Borland JBuilder

6
Core and Optional Packages
  • J2ME can be divided in 3 parts

7
CLDC / CDC
  • A profile is a superset of a configuration, of
    which there are currently two
  • Connected Limited Device Configuration CLDC
  • and
  • Connected Device Configuration CDC

8
MIDP
  • It implements a profile such as MIDP for mobile
    devices or foundation profile for embedded
    devices like set-top boxes

9
Optional Packages
  • Several Optional Packages
  • MMAPI
  • PIM / File Connection
  • WMAPI
  • 3D API
  • Bluetooth

10
Fragmentation?
  • Implementation of optional packages varies across
    devices and manufacturers.
  • Nokia and Sony Ericsson provide consistent
    approach
  • Other manufacturers vary
  • See comparative table on blackboard

11
Specifications
  • Visit developer sites for device specifications

12
Official Developer Sites
  • Nokia www.forum.nokia.com
  • Samsung http//developer.samsungmobile.com/eng/fro
    nt_zone/bbs/bbs_main.jsp?p_menu_id1500
  • Motorola http//developer.motorola.com/
  • Sony Ericsson http//developer.sonyericsson.com/
  • Microsoft http//www.microsoft.com/windowsmobile/d
    evelopers/default.mspx
  • Blackberry http//www.blackberry.com/developers/in
    dex.shtml
  • Siemens https//market.benqmobile.com/portal/main.
    aspx?LangID0pid1
  • Orange Partner
  • http//www.orangepartner.com/site/enuk/home/p_hom
    e.jsp

13
MIDlets
  • A Java program created for Mobile Devices (J2ME
    application)
  • MIDlets will (should) run on any device that
    implements J2ME MIDP
  • Like all Java programs, MIDlets are "compile
    once, run anywhere
  • MIDlet .jar file

14
MIDlet Reqs
  • A MIDlet has to fulfill the following
    requirements in order to run on a mobile phone
  • The main class needs to be a subclass of
    javax.microedition.midlet.MIDlet
  • The MIDlet needs to be packed inside a .jar file
    (e.g. by using the jar-tool)
  • The .jar file needs to be pre-verified by using a
    preverifier.

15
MIDlet Development Process
16
MIDlet
  • A MIDlet is a set of classes designed to be run
    and controlled by the application management
    software
  • The application must extend this class to allow
    the AMS to control the MIDlet and to be able to
    retrieve properties from the application
    descriptor and notify and request state changes.

17
MIDlet
  • The methods of this class allow the AMS to
  • Create
  • Start
  • Pause
  • and destroy a MIDlet.

18
MIDlet Life Cycle
19
Basic MIDlet
  • MainMidlet.java
  • //classes needed for MIDlet execution
  • import javax.microedition.midlet.
  • import javax.microedition.lcdui.
  • public class MainMidlet extends MIDlet
  • public void startApp()
  • //start application from here
  • //set the display
  • public void pauseApp()
  • //pause application
  • public void destroyApp(boolean unconditional)
  • //stop application

20
MIDlet Functions
  • A MIDlet needs to have the following
  • functions in order to compile
  • startApp() this runs when the MIDlet is started
  • pauseApp() this runs when the application is
    paused e.g. incoming call
  • destroyApp() this runs when the MIDlet /
    application is closed

21
MIDlet States and Events
22
MIDP GUI - Display Classes
  • Different from J2SE (Java Standard Ed.)
  • AWT and swing not implemented!

23
High Level GUI
  • Screens, forms, lists, choice, text fields
  • all of these inherit
  • javax.microedition.lcdui.Screen
  • Easy to program pre-defined objects
  • Not very flexible difficult to customize
    objects
  • Unsuitable for multimedia applications although
    it can be used for menus and settings

24
GUI Display Classes
25
Examples of High-Level GUI
26
Low Level GUI
  • Canvas
  • Base class for writing applications that need to
    handle low-level events and to issue graphics
    calls for drawing to the display.
  • Full control over screen display.
  • Ability to process events and key presses.

27
Low Level GUI
  • Canvas Game Canvas
  • (A subclass of Canvas)
  • provides the basis for a game user interface
  • provides game-specific capabilities such as
  • an off-screen graphics buffer
  • the ability to query key status.

28
/ MainMidlet.java / import
javax.microedition.midlet. import
javax.microedition.lcdui. public class
MyMidlet extends MIDlet //variable for
display private Display display //create
new MyGameCanvas private MyGameCanvas mgc
new MyGameCanvas() public void
startApp() // find current display
this.display Display.getDisplay( this )
// attach myGameCanvas to display
this.display.setCurrent(mgc) //start app
public void pauseApp() //pause app
public void destroyApp(boolean
unconditional) // Clear up resourses
notifyDestroyed() //destroyApp //end
class
/ MyGameCanvas.java / //import necessary
graphics classes import javax.microedition.lcdui.
game. import javax.microedition.lcdui.
public class MyGameCanvas extends GameCanvas
/ Creates a new instance of
MyGameCanvas / public MyGameCanvas()
super(true) //constructor public
void paint(Graphics g) /clear the screen
call this method anytime you wish to refresh the
gfx/ flushGraphics() //set the
colour to black in RGB values
g.setColor(0,0,0) / Draws the Hello
world string at x0, y0 location, the text is
aligned to the top left of the screen./
g.drawString("Hello World!!!",0,0,Graphics.T
OPGraphics.LEFT) //paint //class
29
J2ME Online Resources
  • Forum Nokia
  • Orange
  • Sony Ericsson
  • Motorola
  • Sun J2ME
  • Several others available
Write a Comment
User Comments (0)
About PowerShow.com