J2me midp2 0
Download
1 / 31

J2ME MIDP2.0 - PowerPoint PPT Presentation


J2ME MIDP2.0. An Introduction. What is J2ME?. Java 2 Micro Edition Specially cut down version of Java for mobile devices, such as mobile phones, PDAs, Set Top Boxes.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha

Download Presentation

J2ME MIDP2.0

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


J2me midp2 0 l.jpg

J2ME MIDP2.0

An Introduction


What is j2me l.jpg

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.

J2ME 1 – Week 6


J2me configurations 1 l.jpg

J2ME Configurations - 1

  • 2 configurations

  • Connected Limited Device Configuration (CLDC)

    • 16-32bit

    • 160kb – 512 kb memory

    • Battery powered

    • Inconsistent

    • Small-bandwidth network wireless connection

    • May not have user interface (UI)

    • Pagers, PDA, cell phone, Dedicated terminals, handheld consumer devices with 128kb and 512of memory

J2ME 1 – Week 6


J2me configuration 2 l.jpg

J2ME Configuration - 2

  • Connected Device Configuration (CDC)

    • >= 2Mb memory

    • Implement the complete JVM also called the Compact Virtual Machine (CVM)

      • Digital setup boxes

      • home appliances

      • navigation systems

      • point-of-sale terminal

      • smart phone

J2ME 1 – Week 6


What is j2me5 l.jpg

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.

J2ME 1 – Week 6


Why j2me l.jpg

Why J2ME?

  • Supported by over 1Billion handsets

  • Device independent

J2ME 1 – Week 6


J2me development l.jpg

J2ME Development

  • Sun Wireless Toolkit WTK

  • Several IDEs Available:

    • NetBeans

    • Eclipse

    • Sun One

    • Borland JBuilder

J2ME 1 – Week 6


Core and optional packages l.jpg

Core and Optional Packages

J2ME can be divided in 3 parts:

J2ME 1 – Week 6


Cldc cdc l.jpg

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

J2ME 1 – Week 6


Slide10 l.jpg

MIDP

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

J2ME 1 – Week 6


Optional packages l.jpg

Optional Packages

  • Several Optional Packages:

    • MMAPI

    • PIM / File Connection

    • WMAPI

    • 3D API

    • Bluetooth

J2ME 1 – Week 6


Fragmentation l.jpg

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

J2ME 1 – Week 6


Specifications l.jpg

Specifications

  • Visit developer sites for device specifications

J2ME 1 – Week 6


Official developer sites l.jpg

Official Developer Sites

Nokiawww.forum.nokia.com

Samsunghttp://developer.samsungmobile.com/eng/front_zone/bbs/bbs_main.jsp?p_menu_id=1500

Motorola http://developer.motorola.com/

Sony Ericssonhttp://developer.sonyericsson.com/

Microsoft http://www.microsoft.com/windowsmobile/developers/default.mspx

Blackberry http://www.blackberry.com/developers/index.shtml

Siemens https://market.benqmobile.com/portal/main.aspx?LangID=0&pid=1

Orange Partner:

http://www.orangepartner.com/site/enuk/home/p_home.jsp

J2ME 1 – Week 6


Midlets l.jpg

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

J2ME 1 – Week 6


Midlet reqs l.jpg

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.

J2ME 1 – Week 6


Midlet development process l.jpg

MIDlet Development Process

J2ME 1 – Week 6


Midlet l.jpg

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.

J2ME 1 – Week 6


Midlet19 l.jpg

MIDlet

  • The methods of this class allow the AMS to:

    • Create;

    • Start;

    • Pause;

    • and destroy a MIDlet.

J2ME 1 – Week 6


Midlet life cycle l.jpg

MIDlet Life Cycle

J2ME 1 – Week 6


Basic midlet l.jpg

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

}

}

J2ME 1 – Week 6


Midlet functions l.jpg

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

J2ME 1 – Week 6


Midlet states and events l.jpg

MIDlet States and Events

J2ME 1 – Week 6


Midp gui display classes l.jpg

MIDP GUI - Display Classes

  • Different from J2SE (Java Standard Ed.)

    • AWT and swing not implemented!

J2ME 1 – Week 6


High level gui l.jpg

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

J2ME 1 – Week 6


Gui display classes l.jpg

GUI Display Classes

J2ME 1 – Week 6


Examples of high level gui l.jpg

Examples of High-Level GUI

J2ME 1 – Week 6


Low level gui l.jpg

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.

J2ME 1 – Week 6


Low level gui29 l.jpg

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.

J2ME 1 – Week 6


Slide30 l.jpg

/*

* 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 x=0, y=0 location, the text is

aligned to the top left of the screen.*/

g.drawString("Hello World!!!",0,0,Graphics.TOP|Graphics.LEFT);

}//paint

}//class

J2ME 1 – Week 6


J2me online resources l.jpg

J2ME Online Resources

  • Forum Nokia

  • Orange

  • Sony Ericsson

  • Motorola

  • Sun J2ME

  • Several others available…

J2ME 1 – Week 6


ad
  • Login