Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 Using the KToolbar Rob Pooley

Slides:



Advertisements
Similar presentations
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
Advertisements

A batch file is a file that contains a number of DOS commands, each of which could be run individually from the command prompt. By putting them into a.
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Java 2D Training. Basic Tools Java SDK 1.4x Wireless Toolkit 2.x NetBeans IDE + mobility pack Global Code editor Text Comparer Tools Graphics Editor Sprite.
CDM - Quick tour Color Dispense Mix. CDM - Quick tour Welcome in the CDM Quick tour ! It presents you main functions and basic usage of the software.
Creating and Editing a Web Page Using Inline Styles
Loading Excel Double click the Excel icon on the desktop (if you have this) OR Click on Start All Programs Microsoft Office Microsoft Office Excel 2003.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
J2ME 25 July Overview  What is J2ME?  The CLDC and CDC configurations  MIDP and MIDlets  Development Tools  Demonstrations.
Lesson One: The Beginning Chapter 2: Processing Learning Processing Daniel Shiffman Presentation by Donald W. Smith Graphics from built-in help reference.
Writing Your First MIDlet Running JAVA on a Cell Phone Jon A. Batcheller January 27, 2004.
Introduction to Java 2 Micro Edition Mark Balbes, Ph.D. Senior Software Engineer Jeff Brown Senior Software Engineer.
Developing an Application with J2ME Technology Scott Palmer, Nat Panchee, Judy Sullivan, Karen Thabet, Sten Westgard.
J2ME for Palm Speaker: Chen-Nien Tsai Adviser: Kai-Wei Ke.
Introduction to Mobility Java Technology Mobile and Wireless Networks.
Java Programming Working with TextPad. Using TextPad to Work with Java This text editor is designed for working with Java You can download a trial version.
Developing Software for Wireless Devices
PDA Programming Using J2ME Presenter :涂俊凱 Date : 2003/4/8.
Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.
Developing J2ME Applications Mobile and Wireless Networks.
Java Platform, Micro Edition (J2ME)
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
J2ME and WAP Technologies CSCI – Independent Study Fall 2002 Presented by: Kashif Syed.
J2ME Programming. 2 Recommended Books Programming Wireless Devices with the Java2 Platform, Micro Second Edition (Paperback) by Roger Riggs (Editor),
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 19 Microsoft’s Approach 1 –.NET Mobile Framework part 2 Rob.
Digital Image Processing Lecture3: Introduction to MATLAB.
J2ME Java for Mobile Environments Based on J2ME In A Nutshell, by Kim Topley, O’Reilly & Associates Inc., 2002, and Tetris by Alexei Patinov.
An Introduction to the Java ME Project Jens A Andersson.
Platforms and tools for Web Services and Mobile Applications J2ME based Applications Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Michael Brockway Advanced Applications Development in Java J2ME -- Introduction l Introduction / Overview l Java 2 Micro Edition n CLDC n MIDP l Examples.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 11 J2ME and MIDlets Rob Pooley
Lecture 2 Event driven programming Mobile and Handheld Applications1 Programming of Handheld and Mobile Devices Lecture 2: Event driven programming concepts.
Java Programming, 3e Concepts and Techniques Chapter 3 Section 65 – Manipulating Data Using Methods – Java Applet.
Mobile Applications and Java ME
Lecture 16Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 16 Bluetooth for MIDlets Rob Pooley
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 lcdui Rob Pooley
Creating a Project with C++ Builder
1 Chapter 1 Introduction to Java. 2 History of Java Java Originally for _________________________ devices Then used for creating Web pages with __________________________.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 23 Summing up Rob Pooley
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 13 lcdui and OXO Rob Pooley
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 14 Various MIDlet examples Rob Pooley
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 19 MIDlet to Palm Rob Pooley
Programming of Handheld and Mobile Devices Lecture 2 What is a MID? Rob Pooley
IDLE An IDE for Python bundled with the program release Click on IDLE (Python GUI) in the Start menu under the Python program group  Get the IDLE Python.
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
Lecture 3 Programming on Palm OS Mobile and Handheld Applications1 Programming of Mobile and Handheld Devices Lecture 3: Programming for Palm OS Rob Pooley.
Chapter 3 I Need a Tour Guide (Introduction to Visual Basic 2010) Clearly Visual Basic: Programming with Visual Basic nd Edition.
THE C PROGRAMMING ENVIRONMENT. Four parts of C environment  Main menu  Editor status line and edit window  Compiler message window  “Hot Keys” quick.
Java 2 Platform, Micro Edition (J2ME)
The Development Process Compilation. Compilation - Dr. Craig A. Struble 2 Programming Process Problem Solving Phase We will spend significant time on.
1 Introduction to J2ME Outline MIDP Building J2ME Apps- Tool J2ME Wireless Toolkit Demo MIDlet Programming -- MIDlet Transition States -- Midlet Skeleton.
1 1 1 Introduction to Java. 2 History of Java Java – Originally for intelligent consumer-electronic devices – Then used for creating Web pages with dynamic.
Lab 2: J2ME: Java 2 Micro Edition (Writing Programs for Mobile Phones using Java) Luis F. G. Sarmenta draft 3/13/2008 MIT D-Lab ICT4D.
CS 201 Lecture 1 (b) Using an IDE Tarik Booker CS 201: Introduction to Programming California State University, Los Angeles.
CSE403: MIDlets and Ant1 MIDlets and Ant April 3, 2003 Shane Cantrell Zach Crisman.
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
Java N Amanquah.
A Short DOS Presentation
Java- LWUIT N Amanquah.
Using a set-up file to read ASCII data into SPSS
Mobile Software Development Framework: Android
J2ME Command Class.
J2ME User Interface I.
Java for Mobile Devices
Presentation transcript:

Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 Using the KToolbar Rob Pooley

Programming Handheld and Mobile devices 2 J2ME Toolkit The J2ME toolkit provides –An IDE (but minus an editor) –A set of simulators/emulators –A set of examples You should find it on the menu –Start/Programs/J2ME Wireless Toolkit 2.2/KToolbar It supports general J2ME programming using the KVM

Programming Handheld and Mobile devices 3 Open the KToolBar

Programming Handheld and Mobile devices 4 Projects in KToolbar You can either open an existing project

Programming Handheld and Mobile devices 5 Pick a project

Programming Handheld and Mobile devices 6 Ready to build

Programming Handheld and Mobile devices 7 Or create one from scratch First create a Java source file using a text editor such as Notepad or any other of your choice –Don’t create Word or other specialised formats –Just plain text –Save as filename.java –Save into the appropriate directory Now select new project –Give the project name and the name of the MIDlet Now proceed as with opening an existing project

Programming Handheld and Mobile devices 8 Building and running Select build –If all is well you get confirmation that it worked –If there is a problem you need to edit the source to fix it, saving the source file –Then build again Now select run The selected device is used to show the project running Interact as if it was a real mobile phone or PDA

Programming Handheld and Mobile devices 9 import javax.microedition.lcdui.*; import javax.microedition.midlet.MIDlet; public class Bounder extends MIDlet implements CommandListener { public void startApp() { Display display = Display.getDisplay(this); Form mainForm = new Form("TinyMIDlet"); mainForm.append("Welcome to the world of MIDlets!"); Command exitCommand = new Command("Exit", Command.EXIT, 0); mainForm.addCommand(exitCommand); mainForm.setCommandListener(this); display.setCurrent(mainForm); } public void pauseApp () {} public void destroyApp(boolean unconditional) {} public void commandAction(Command c, Displayable s) { if (c.getCommandType() == Command.EXIT) notifyDestroyed(); } This small example shows the Lowest Common Denominator GUI API in use The MIDlet is also a CommandListener In startAPP –A Display object is set up and associated with this MIDlet. –A Form is set up with label TinyMIDlet. –The Form is also given the text “Welcome…” –A Command is set up with the label “Exit”, the type EXIT and priority 0 –This command is added to the Form, so that it will be triggerable when the form is in use. –This MIDlet is made a CommandListener for the Form –The Form is made the current object being displayed. commandAction is the CommandListener method which handles actions for the Form. –When an EXIT action occurs the MIDlet destroys itself

Programming Handheld and Mobile devices 10 Example import javax.microedition.lcdui.*; import javax.microedition.midlet.MIDlet; public class Bounder extends MIDlet implements CommandListener { public void startApp() { Display display = Display.getDisplay(this); Form mainForm = new Form("TinyMIDlet"); mainForm.append("Welcome to the world of MIDlets!"); Command exitCommand = new Command("Exit", Command.EXIT, 0); mainForm.addCommand(exitCommand); mainForm.setCommandListener(this); display.setCurrent(mainForm); } public void pauseApp () {} public void destroyApp(boolean unconditional) {} public void commandAction(Command c, Displayable s) { if (c.getCommandType() == Command.EXIT) notifyDestroyed(); } I put this in the folder C:\WTK22\apps\FirstTry\src I called it Bounder.java I created a project called FirstTry I specified the MIDlet as Bounder Build and run did the rest

Programming Handheld and Mobile devices 11 The quiz example phase 1 import javax.microedition.lcdui.*; import javax.microedition.midlet.MIDlet; public class GuessALot extends MIDlet implements CommandListener { public void startApp() { Display display = Display.getDisplay(this); Form mainForm = new Form("Quiz Game"); mainForm.append("Welcome to Guess a Lot"); Command exitCommand = new Command("Exit", Command.EXIT, 0); Command historyCommand = new Command("History", Command.OK, 0); Command mathsCommand = new Command("Mathematics", Command.ITEM, 0); mainForm.addCommand(exitCommand); mainForm.addCommand(historyCommand); mainForm.addCommand(mathsCommand); mainForm.setCommandListener(this); display.setCurrent(mainForm); }

Programming Handheld and Mobile devices 12 public void pauseApp () {} public void destroyApp(boolean unconditional) {} public void commandAction(Command c, Displayable s) { if (c.getCommandType()==Command.EXIT) notifyDestroyed(); else if (c.getCommandType()==Command.ITEM) ;//code to open Maths window else if (c.getCommandType()==Command.OK) ;//code to open history window else; //default case }

Programming Handheld and Mobile devices 13

Programming Handheld and Mobile devices 14 Running the MIDlet Press the launch button

Programming Handheld and Mobile devices 15 EXIT gets a default position Two more buttons so a menu is created

Programming Handheld and Mobile devices 16 Arrow keys to choose Select button to make selection

Programming Handheld and Mobile devices 17 Developing the quiz application public class GuessALot extends MIDlet implements CommandListener { Form mainForm, historyForm, mathsForm; Display display; public void startApp() { display = Display.getDisplay(this); mainForm = new Form("Quiz Game"); mainForm.append("Welcome to Guess a Lot"); Command exitCommand = new Command("Exit", Command.EXIT, 0); Command historyCommand = new Command("History", Command.OK, 0); Command mathsCommand = new Command("Mathematics", Command.ITEM, 0); mainForm.addCommand(exitCommand); mainForm.addCommand(historyCommand); mainForm.addCommand(mathsCommand); mainForm.setCommandListener(this); historyForm = new Form("History questions"); historyForm.append("When was the battle of Hastings?"); Command hRightCommand = new Command("1066", Command.HELP, 0); Command hWrongCommand = new Command("1966", Command.CANCEL, 0); historyForm.addCommand(hRightCommand); historyForm.addCommand(hWrongCommand); historyForm.setCommandListener(this); display.setCurrent(mainForm); }

Programming Handheld and Mobile devices 18 public void pauseApp () {} public void destroyApp(boolean unconditional) {} public void commandAction(Command c, Displayable s) { if (c.getCommandType()==Command.EXIT) notifyDestroyed(); else if (c.getCommandType()==Command.ITEM) ;//code to open Maths window else if (c.getCommandType()==Command.OK) display.setCurrent(historyForm);//open history window else; //default case }

Programming Handheld and Mobile devices 19

Programming Handheld and Mobile devices 20 Carrying on We can add the same Forms as we had in the Palm OS version We can experiment with other lcdui features We can use Alert to flag outcomes How does MIDP compare with Palm OS?