Docsity

Application Development for Mobile Devices Lecture2 - Introduction to Java ME, Study notes of Mobile Computing

Partial preview of the text

Download Application Development for Mobile Devices Lecture2 - Introduction to Java ME and more Study notes Mobile Computing in PDF only on Docsity!

Lecture 2

Introduction to Java ME (Java

Platform, Micro Edition)

Stelios Kapetanakis & Markus A. Wolf

Based on material from Gill Windall

1 Application Development for Mobile Devices

Contents Overview of Java ME configurations profiles alphabet soup! Building MIDlets tools using Java ME Wireless Toolkit using NetBeans hello world MIDlet what's the temperature in Sydney?

Java ME configurations and profiles (2)

Java ME

CLDC

Connected Limited Device Configuration

CDC

Connected Device Configuration Information Module Foundation Profile Personal Basis Profile Personal Profile

MIDP

Mobile Information Device Profile

Connected Device Configuration

Typical target device characteristics 2.5MB ROM 2MB RAM 32 bit processor network connection Device types set-top boxes high-end PDAs Very smart phones JVM is the same specification as the one used with Java SE Current version is 1.

Markus A. Wolf

Mobile Information Device Profile

Minimum device characteristics At least 8KB memory for persistent data screen of at least 96 x 54 pixels Input capability e.g. keypad keyboard screen 2 way network connection – probably intermittent Current versions MIDP 1.0 and MIDP 2. 7 MIDP 2.0 contains enhancements, such as multimedia support, HTTPS connection, etc.

Pause for breath It's all quite confusing - an “alphabet soup” + lots of version numbers Suppose you have been asked by your employer to develop software to run on the range of mobile devices used by their enterprise why might you consider Java ME? where would you look to find information about what Java ME configurations and profiles are appropriate?

Help ... it's all too MSA confusing! JVM JTWI CDLC CDC profiles configurations MIDP API It is confusing because of

  • (^) the diversity of mobile devices
  • (^) the rate of technology change How to deal with the confusion?
  • (^) Ignore it and hope it'll go away?
  • (^) Understand everything about everything?
  • (^) Start by understanding some core concepts?
  • (^) Start by getting some practical experience?
  • (^) Identify good sources of information?

Contents Overview of Java ME configurations profiles alphabet soup! Building MIDlets tools using J2ME Wireless Toolkit using NetBeans hello world MIDlet what's the temperature in Sydney?

MIDlet development tools Lots available including: Sun's MIDP reference implementation command line and fiddly Sun Java Wireless Toolkit for CLDC (JWTK) a simple GUI built on top of the reference implementation NetBeans + Mobility Pack Borland JBuilder Mobile Studio IBM WebSphere Studio Device Developer etc Integrated Development Environments (IDEs)

Markus A. Wolf

Developing a MIDlet using Java WTK

create a project using the JWTK write the code in EditPlus test using JWTK emulator compile and pre-verify using JWTK 14

Write the code in EditPlus (1) package hw; import javax.microedition.midlet.; import javax.microedition.lcdui.; public class HelloWorld extends MIDlet implements CommandListener { private Display mDisplay; private Form mForm; private StringItem mMessage; private Command mExitCommand; public HelloWorld() { mForm = new Form("Hello World MIDlet"); mMessage = new StringItem("message: ", "Hello World"); mForm.append(mMessage); mExitCommand = new Command("Exit", Command.EXIT, 0); mForm.addCommand(mExitCommand); mForm.setCommandListener(this); } HelloWorld.java - code continued on next slide you don't need to understand all the code that this stage

Write the code in EditPlus (2) public void startApp() { mDisplay = Display.getDisplay(this); mDisplay.setCurrent(mForm); } public void commandAction(Command c, Displayable s) { if (c == mExitCommand) { destroyApp(false); notifyDestroyed(); } } public void pauseApp() {} public void destroyApp(boolean unconditional) {} } // end of class HelloWorld

Test in the

WTK emulator

Again - couldn't be easier - just click the Run button

Same again with NetBeans write the code test using emulator "Build" the MIDlet create a MIDLet in NetBeans