SlideShare a Scribd company logo
1 of 66
Unit-II
J2ME Architecture
 Small Computing Device Requirements
Run-Time Environment
 MIDlet Programming
Java Language for J2ME
 J2ME Software Development Kits
 Hello World J2ME Style
Multiple MIDlets in a MIDlet Suite
J2ME Wireless Toolkit
J2ME architecture
1. J2ME architecture
 The design of j2me architecture provides the scalability to an application based on
the constraints of the small computing devices.
 J2me architecture does not replace the operating system of small computing devices
J2me architecture consists of layers located above the native operating system.
J2ME architecture
Three layers
1. Configuration layer- includes the jvm, which interacts the operating
system. and also interacts the profiles and jvm.
2. Profile layer- it provides the java API used to implement the
applications for the small computing devices.
3. MIDP- provides classes for the network connections, user interface and
persistent storage.
small computing devices has two components provided by the original
equipment manufacturers.
1. OEM classes- these are used by the MIDP to access the features of the
specific device such as sending and receiving messages and access
persistent storage.
2. OEM applications- these can be accessed by the MIDP such as address
book.
Note:- these components are not portable since all the small computing
devices does not use the same OEM classes and OEM applications.
2. Small computing device requirements
• Hardware requirements
- display 96 X 54 pixel should supports the bitmapped pixels.
- key pad, keyboard, or touch screen for input
- ROM - 128KB to run the Mobile information Device (MID)
- 8KB for permanent storage like applications data.
- RAM - 32KB to run JVM
- device must provide the two way network connectivity (SIM)
• software requirements
- native operating system ( which is supported by specific system)
- it must includes the exception handling, scheduling, process interrrupts,
ability to run the JVM
- file system does not required to run the JVM
- able to read and write permanent data on to the nonvolatile memory.
3. Run time environment
• MIDlet( MIDP applications ) - is a J2ME program specific for the J2ME
virtual machine to run applications on small computing devices like
cellphones.
 MIDlet has atleast one class that is derived from the
javax.microedition.midlet.MIDlet abstract class.
 MIDlet required the device which implements with the J2ME, MIDP to
run.
 MIDlet are compiled once and run anywhere
 a group of MIDlet are packed into MIDlet suit.
 MIDlet suite uses the same instance of java class and run within the same
JVM.
 Advantage of MIDlet suite is that all the MIDlets which are belong to same
MIDlet suite share the same data so it reduces the data errors during the
concurrent read and write access to a data.
 MIDlet suit installed, executed and removed by the application manager which is
provided by the manufactures and run on the device.
 Once this is installed on the device each member of the MIDlet suit can have
access to the classes and methods of the JVM and CLDC ( configuration layer)
bye the application manager.
 MIDlet suite consists of two files
1. .JAR file
2. .JAD file
.JAR file- it contains compiled classes in a compressed and preverified manner.
- several MIDlets are included in the MIDlet suite all its classes are
includes in the .JAR file.
- and also includes the graphics images and the manifest file.
JAR
 All the files necessary to implement a MIDlet suite must
be contained within a production package called a Java
archive (JAR) file.
 These files include MIDlet classes, graphic images (if
required by a MIDlet), and the manifest file.
 The manifest file contains a list of attributes and related
definitions that are used by the application manager to
install the files contained in the JAR file onto the small
computing device.
 Nine attributes are defined in the manifest file; all but six
of these attributes are optional.
Manifest file- list of attributes and definitions used by the application.
- nine attributes define in Manifest file, six are mandatory
Attributes of the manifest file
• Go to project folder, see bin folder and open
manifest file.
MIDlet-2: HelloWorld, , hello.
HelloWorldMIDlet-1: HelloMIDlet, , hello.
HelloMIDletMIDlet-Vendor: Vendor
MIDlet-Name: MobileApplication5
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
JAD file
• A JAD file is also used to provide the application
manager with additional content information about the
JAR file to determine whether the MIDlet suite can be
implemented on the device.
• All JAD files must have the .jad extension
• A JAD file is similar to a manifest in that both contain
attributes that are name:value pairs. Name:value pairs
can appear in any order within the JAD file. There are
five required system attributes for a JAD file:
JAD file
• MIDlet-Name
• MIDlet-Version
• MIDlet-Vendor
• MIDlet-n
• MIDlet-Jar-URL
• The first three attributes in the JAD file are identical to
attributes in the manifest file.
MIDlet-1: HelloMIDlet, ,
hello.HelloMIDlet
MIDlet-2: HelloWorld, ,
hello.HelloWorld
MIDlet-Jar-Size: 2354
MIDlet-Jar-URL: MobileApplication5.jar
MIDlet-Name: MobileApplication5
MIDlet-Vendor: Vendor
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
• C:Documents and
settingsAdministratorj2mewtk2.5.2appssnistbin
• in bin folder you can find manifest file and jad file
• to create jar file – goto sun java wirelss tool kit 2.5.2->
project-> create package
• then jar would created in the bin folder, extract file it
includes manifest file, .class file and images with .png
extension.
MIDlet Programming
• Programming a MIDlet is similar to creating a J2SE
application in that define a class and related methods
• Less Robust
• A MIDlet is a class that extends the MIDlet class and is
the interface between application statements and the
run-time environment, which is controlled by the
application manager.
MIDP Applications (MIDlets) and MIDlet Lifecycle
• When j2me application (MIDlet) is created it must extended
from the MIDlet class in javax.microedition.midlet.MIDlet
• MIDlet class as three abstract methods that are called by the
Application manager software (AMS).
• When MIDlet starts to run, it goes into three phases which are
controlled by the AMS.
1.pasueApp()
2. startApp()
3. destroyApp();
Stages of MIDlet's lifecycle
1. When the MIDlet is about to be run, an instance
of javax.microedition.midlet.MIDlet class is created. The MIDlet's class
constructor with 0 arguments is run, and the MIDlet is in the Paused
state.
2. Next, MIDlet move into Active state after application manager
calling startApp() method which implement with extend MIDlet class.
3. While the MIDlet is Active state, the application manager can suspend
its execution by calling pauseApp() method
4. After application manager execute startApp() method, can terminate the
execution by calling destroyApp() method.
5. A MIDlet can destroy itself by calling notifyDestroyed() method.
• public class HelloWorld extends MIDlet
{
public void startApp()
{ }
public void pauseApp()
{ }
public void destroyApp( boolean unconditional ) { }
}
• Both the startApp() and pauseApp() methods are public
and have no return value nor parameter list.
• The destroyApp() method is also a public method without
a return value.
• However, the destroyApp() method has a boolean
parameter that is set to true if the termination of the
MIDlet is unconditional and false if the MIDlet can throw a
MIDletStateChangeException telling the application
manager that the MIDlet does not want to be destroyed
just yet.
• At the center of every MIDlet are the MIDP API classes
used by the MIDlet to interact with the user and handle
data management.
• User interactions are managed by user interface MIDP
API classes.
• These APIs enable a developer to display screens of data
and prompt the user to respond with an appropriate
command. The command causes the MIDlet to execute
oneof three routines: perform a computation, make a
network request, or display another screen.
• The data-handling MIDP API classes enable the
developer to perform four kinds of data routines:
• write and read persistent data, store data in data types,
receive data from and send data to a network, and
interact with the small computing device’s input/output
features.
Event Handling
• A MIDlet is an event-based application.
• All routines executed in the MIDlet are invoked in
response to an event reported to the MIDlet by the
application manager.
• The initial event that occurs is when the MIDlet is started
and the application manager invokes the startApp()
method.
• The startApp() method in a typical MIDlet contains a
statement that displays a screen of data and prompts the
user to enter a selection from among one or more
options. The nature and number of options is MIDlet and
screen dependent.
Event Handling
• A Command object is used to present a user with a
selection of options to choose from when a screen is
displayed.
• Each screen must have a CommandListener.
• A CommandListener monitors user events with a screen
and causes the appropriate code to execute based on
the current event.
User interfaces
• Some small computing devices contain resources that
provide a rich user interface, while other more resource-
constrained devices offer a modest user interface.
• A rich user interface contains the following elements,
and a device with a minimal user interface has some
subset of these elements as determined by the profile
used for the device.
• A Form is the most commonly invoked user interface
element found in a MIDlet and is used to contain other
user interface elements. Text is placed on a form as a
StringItem, a List, a ChoiceGroup, and a Ticker
• A StringItem contains text that appears on a form that
cannot be changed by the user.
• A List is an itemized options list from which the user can
choose an option.
• A ChoiceGroup is a related itemized options list.
• And a Ticker is text that is scrollable.
• A user enters information into a form by using the Choice
element, TextBox, TextField, or DateField elements.
• The Choice element returns an option that the user
selected.
User interfaces
User interfaces
• TextBox and TextField elements collect textual
information from a user and enable the user to edit
information that appears in these user interface
elements.
• The DateField is similar to a TextBox and TextField
except its contents are a date and time
• An Alert is a special Form that is used to alert the user
that an error has occurred. An Alert is usually limited to a
StringItem user interface element that defines the nature
of the error to the user
Device Data
• A MIDlet can use an MIDP class—RecordStore—and
two MIDP interfaces— RecordComparator and
RecordFilter—to write and read persistent data.
• A RecordStore class contains methods used to write
and read persistent data in the form of a record.
• Persistent data is read from a RecordStore by using
either the RecordComparator interface or the
RecordFilter interface
Java Language for J2ME
• CDC implements the full J2SE available, but CLDC implements a
stripped-down J2SE
• Floating-point math is probably the most notable missing feature of
J2ME. MIDlet cannot use any floating-point data types or
calculations.
• Absence of support for the finalize() method
• Reduced number of error-handling exceptions
• Changes were also made in the Java Virtual Machine that runs on a
small computing device because of resource constraints. One such
change occurs with the class loader. JVM for small computing
devices requires a custom class loader that is supplied by the
device manufacturer and cannot be replaced or modified.
• Another feature lacking in the JVM is the ThreadGroup class. You
cannot group threads.
• Two other features of J2SE that are missing from J2ME are weak
references and the Reflection classes
• The standard JVM uses class file verification to protect applications
from malicious code through the use of a security manager.
However, this process is replaced with a two-step process because
of the limited resources available on small computing devices
J2ME Software Development Kits
• A MIDlet is built using free software packages that are
downloadable from the java.sun .com
• Although we can purchase third-party development products such
as Borland JBuilder Mobile Set, Sun One Studio 4 (formerly Forte
for Java), and WebGain VisualCafe Enterprise Suite.
• Three software packages need to be downloaded from
java.sun.com.
• Java Development Kit (1.3 or greater) (java.sun.com/
j2se/downloads.html),
• Connected Limited Device Configuration (CLDC) (java.sun.
com/products/cldc/),
• Mobile Information Device Profile (MIDP) (java.sun.com/
products/midp/).
• And also need the J2ME Wireless Toolkit to develop MIDlets for
handheld devices
(java.sun.com/products/j2mewtoolkit/download.html).
• Install the CLDC once the Java development kit is installed.
• Unzip the downloaded CLDC files fromthe java.sun.com web site
onto the d:j2me directory(J2ME_HOME) on your computer.
• You’ll need to create the j2me directory if one doesn’t exist.
Unzipping the CLDC package creates the j2me_cldc subdirectory
below the j2me directory
• Each platform is in its own subdirectory under j2me_cldc. Add the
j2mej2me_cldcbinwin32 subdirectory to the PATH environment
variable
• Next, download and unzip the MIDP file. Be sure to use j2me as the
directory for the MIDP file. Unzipping the MIDP file creates a midp
directory.
• you’ll need to include the j2memidp1.0.3fcsbin subdirectory in the
PATH environment variable.
Installation and setting paths
• Next, create two environment variables. These are CLASSPATH
and MIDP_HOME.
• The CLASSPATH environment variable identifies the path to be
searched whenever a class is invoked.
• Set the CLASSPATH to d:j2memidp1.0.3fcsclasses;
• The MIDP_HOME environment variable identifies the location of
the lib directory that contains the internal.config file and the
system.config file.
• Set the MIDP_HOME environment variable to d:j2memidp1.0.3fcs
creating a directory structure within which
you can create and run MIDlets
• J2me
• j2mesrc
• j2mesrcgreeting
• j2metmp_classes
• j2memidlets
HelloWorld Example
• The HelloWorld MIDlet performs three basic functions that are found
in nearly all MIDlets. These are to display a text box and a
command on the screen, then listen to events that occur while the
MIDlet is running
• The HelloWorld MIDlet is created by defining a class called
HelloWorld that extends the MIDlet class and implements a
CommandListener.
• The HelloWorld class contains three private data members and four
methods. The data members are a Display object, a text box, and a
command. The methods are startApp(), pauseApp(), and
destroyApp(). The fourth method is called commandAction() and is
invoked by the application manager whenever an event occurs
• Twopackages must be imported at the beginning of the MIDlet to
access MIDlet classes and lcdui classes.
• MIDlet classes are screen oriented and create a Display object and
then place components of the screen into the Display object
• The startApp() method contains the necessary statements to invoke
previously defined objects
• Calling getDisplay multiple times always returns the same Display
reference for the specified MIDlet.
• An instance of a command object is created.
Command- a label, a type, and a priority
Label- string
Type- specifies type of the command
- BACK,EXIT,CANCEL,OK,SCREEN,ITEM,HELP,STOP.
Priority- importance of the command with the other commands on the screen.
it may be integer.
The last instance is TextBox object. Four values are necessary to create an
instance of a TextBox object. The first is the caption for the TextBox
object followed by the text that will appear in the TextBox object. The
other two values are coordinates used by the application manager to
position the TextBox object on the screen
Compiling Hello World
• Make j2mesrcgreeting the current directory
• javac -d d:j2metmp_classes -target 1.1 -bootclasspath
d:j2memidp1.0.3fcsclasses HelloWorld.java
• The bootclasspath option points to the startup class files commonly
referred to as the Java bootstrap files.
• Next, you’ll need to preverify the HelloWorld.class that was
generated by the compiler. Make sure that j2mesrcgreeting is the
current directory and enter the following command:
• preverify -d d:j2meclasses -classpath d:j2memidp1.0.3fcsclasses
d:j2metmp_classes
• The -d option places the class file within the tmp_classes directory.
The second option is -classpath, which points to the location of the
library classes that come with the MIDP.
Running HelloWorld
• There are two ways to run a MIDlet. These are either by invoking
the MIDlet class or by creating a JAR file, then running the MIDlet
from the JAR file.
• Make sure that j2mesrc greeting is the current directory, and then
enter the following command
• midp -classpath d:j2meclasses greeting.HelloWorld
Deploying HelloWorld
• The MIDlet suite is then packaged into a JAR file along with other
related files for downloading to a small computing device. This
process is commonly referred to as packaging
• create the manifest file
• MIDlet-1: HelloWorld, , greeting.HelloWorld
• MIDlet-Name: Hello World
• MIDlet-Version: 1.0
• MIDlet-Vendor: Jim
• MIDlet-1: HelloWorld, /greeting/myLogo.png, greeting.HelloWorld
MicroEdition-Configuration: CLDC-1.0
• MicroEdition-Profile: MIDP-1.0
• create the JAR file once the manifest.txt file is saved in the j2mesrc
greeting directory.
• create the JAR file by entering the following command:
• jar -cfvm d:j2memidletsHelloWorld.jar manifest.txt -C
d:j2meclasses greeting
• Create the JAD file
• MIDlet-Name: Hello World
• MIDlet-Version: 1.0
• MIDlet-Vendor: Jim
• MIDlet-Description: My First MIDlet suite
• MIDlet-1: HelloWorld, /greeting/myLogo.png, greeting.HelloWorld
MIDlet-Jar-URL: HelloWorld.jar
• MIDlet-Jar-Size: 1428
• Copy the HelloWorld.jad file into the j2me/midlets directory
• Then make j2me/midlets the current directory.
• Invoke the MIDlet by entering the following command.
• midp -classpath HelloWorld.jar -Xdescriptor HelloWorld.jad
Packages available in J2ME
• Java.lang
• Java.io
• Java.util
• Javax.microedition.io
• Javax.microedition.lcdui
• Javax.microedition.midlet.
• Javax.microedition.rms.
Javax.microedition.lcdui- provides a set of features for
implementation of user interfaces for MIDP applications.
• Interfaces
1. Choice
2. CommandListener
3. ItemStateListener
classes
1. Alert
2. Command
3. Display
4. Displayable
5. Form
6. Font
7. Image
8. TextBox etc
Javax.microedition.midlet.
MIDlet package defines Mobile Information Device Profile applications and
the interactions between the application and the environment in which the
application runs.
Classes
1. MIDlet
Exception
MIDletStateChangeException
Display- manger of the display and input device of the system.
MIDlet classes are screen oriented
- 1st
create the Display object on which we can place all the
components of the screen into the Display object
- this display object calling the method getDisplay().to display
the screen on the small computing devices.
- setCurrent()- The Display class has a setCurrent() method for setting the
current Displayable ( Form)
Displayable- objects that are capable of being placed on the
display
ex- Form, Command all are Displayable objects.
Form- A Form is a Screen that contains an arbitrary mixture of items:
images, read-only text fields, editable text fields
notifyDestroyed(); - Used by an MIDlet to notify the
application management software that it has entered
into the Destroyed state.
Command- a label, a type, and a priority
Label- string
Type- specifies type of the command
- BACK,EXIT,CANCEL,OK,SCREEN,ITEM,HELP,STOP.
Priority- importance of the command with the other commands on
the screen.
it may be integer.
- commandAction( Command c, Displayable d)
* this method in interface CommandListener
* Indicates that a command event has occurred on Displayable d.
Multiple MIDlets in a MIDlet Suite
 add multiple MIDlets to the MIDlet Suite
 AMS displays the MIDlets in menu option and enables the user to
run one MIDlet at a time.
 How to create MIDlet Suite
step-1 : open sun_java_wireless toolkit and click on settings
Step-2 : click on MIDlets and click add button
Java Language for J2ME
 Floating- point math not available on J2ME.
- special processor hardware required for the float point calculations but small computing
devices lack in hardware
- MIDlet cannot support floating point calculations
 Absence of Finalize() method
 Fewer error handling exceptions
- error handling exceptions grabs the system resources which are very less in small
computing devices.
- run time exceptions are handled by the underlying native operating system.
 Weak references and no reflection classes.
 Some changes made in the JVM which runs on small computing devices
1. class loader: JVM of small computing devices have custom class loader that is
supplied by the manufactures only those cannot be modified or replaced
2. Thread group class: threads cannot be grouped. All the threads handled by the object
level.
 J2SE uses the file verification to protect from malicious code through the use of a
security manager. whereas, in J2ME this took place in two steps
1. preverification- done outside of the small computing devices before loading MIDlet
2. MIDlet class loaded on to the device and verifier in small computing devices validates
each instruction in the MIDlet class.
Alert- it is screen that shows the data to the user and wait for some time to
process the next displayable.
- it contains text and images.
AlertType.INFO- provides non threatening
information to the user.
J2ME Wireless Toolkit
• J2ME Wireless Toolkit that is downloadable from
java.sun.com/products/j2mewtoolkit/download.html.
• It is used to develop and test J2ME applications by selecting a few
buttons from a toolbar
• J2ME Wireless Toolkit is a stripped-down integrated development
environment in that it does not include an editor, a full debugger,
and other amenities found in a third-party integrated development
environment.
• Building and Running a Project
• Ktoolbar is the executable within the directory that launches the
Toolkit. The main window is displayed when you run ktoolbar
Step- 3 : click ok button on Enter MIDlet Details
Step -4 : Click ok
Step- 5: go to project (MIDlet suite) to which you added
MIDlets and open manifest file in bin folder.
MIDlet-1: ExampleTb, ExampleTb.png, ExampleTb
MIDlet-2: MidletLifecycle, MidletLifecycle.png,
MidletLifecycle
MIDlet-Name: TextBoxEx
MIDlet-Vendor: Unknown
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-2.0
Step- 6 : place MIDlets in the src folder of the
MIDlet Suite
Step – 7 : build the project
step- 8 : run project
JAVA ME SDK
• The Oracle Java, Micro Edition (Java ME) Software Development
Kit (SDK) provides device emulation, a standalone development
environment and a set of utilities for rapid development of Java ME
applications.
• It integrates the Connected Limited Device Configuration (CLDC)
and the Connected Device Configuration (CDC) technology into one
simple development environment.
• The Java ME SDK is a successor to the Sun Java Wireless Toolkit
and the Java Toolkit for CDC and offers improved device emulation,
a standalone lightweight development environment, and powerful
tools to speed application development.
Key Features:
• A single SDK for application development for the full range of Java
ME device targets
• Built-in emulators for application prototyping
• Customizable device skins for your development environment
• NetBeans and Eclipse plugins for better IDE integration
• On-device tooling for remote application management and
debugging
• Application profiling, network monitoring, and memory monitoring
•
Mobile Application Development  MAD J2ME UNIT 2
Mobile Application Development  MAD J2ME UNIT 2

More Related Content

What's hot

Internet of Things: Research Directions
Internet of Things: Research DirectionsInternet of Things: Research Directions
Internet of Things: Research DirectionsDavide Nardone
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Elizabeth alexander
 
Mobile Application Devlopement-Database connections-UNIT-5
Mobile Application Devlopement-Database connections-UNIT-5Mobile Application Devlopement-Database connections-UNIT-5
Mobile Application Devlopement-Database connections-UNIT-5Pallepati Vasavi
 
Introduction to Mobile programming(J2ME)
Introduction to Mobile programming(J2ME)Introduction to Mobile programming(J2ME)
Introduction to Mobile programming(J2ME)Wambua Wambua
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development pptGautam Kumar
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecturedeepakshare
 
Day: 1 Introduction to Mobile Application Development (in Android)
Day: 1 Introduction to Mobile Application Development (in Android)Day: 1 Introduction to Mobile Application Development (in Android)
Day: 1 Introduction to Mobile Application Development (in Android)Ahsanul Karim
 
Android styles and themes
Android styles and themesAndroid styles and themes
Android styles and themesSourabh Sahu
 
Scripting languages
Scripting languagesScripting languages
Scripting languagesteach4uin
 
Introduction to Android ppt
Introduction to Android pptIntroduction to Android ppt
Introduction to Android pptTaha Malampatti
 
M2M vs IoT: The Key Differences and Similarities
M2M vs IoT: The Key Differences and SimilaritiesM2M vs IoT: The Key Differences and Similarities
M2M vs IoT: The Key Differences and SimilaritiesNavjyotsinh Jadeja
 

What's hot (20)

Internet of Things: Research Directions
Internet of Things: Research DirectionsInternet of Things: Research Directions
Internet of Things: Research Directions
 
Chapter 8
Chapter 8Chapter 8
Chapter 8
 
Android Widget
Android WidgetAndroid Widget
Android Widget
 
Java awt (abstract window toolkit)
Java awt (abstract window toolkit)Java awt (abstract window toolkit)
Java awt (abstract window toolkit)
 
Mobile Application Devlopement-Database connections-UNIT-5
Mobile Application Devlopement-Database connections-UNIT-5Mobile Application Devlopement-Database connections-UNIT-5
Mobile Application Devlopement-Database connections-UNIT-5
 
Introduction to Mobile programming(J2ME)
Introduction to Mobile programming(J2ME)Introduction to Mobile programming(J2ME)
Introduction to Mobile programming(J2ME)
 
Android application development ppt
Android application development pptAndroid application development ppt
Android application development ppt
 
Android Architecture
Android ArchitectureAndroid Architecture
Android Architecture
 
Day: 1 Introduction to Mobile Application Development (in Android)
Day: 1 Introduction to Mobile Application Development (in Android)Day: 1 Introduction to Mobile Application Development (in Android)
Day: 1 Introduction to Mobile Application Development (in Android)
 
Android styles and themes
Android styles and themesAndroid styles and themes
Android styles and themes
 
cloud computing ppt
cloud computing pptcloud computing ppt
cloud computing ppt
 
Scripting languages
Scripting languagesScripting languages
Scripting languages
 
Android User Interface
Android User InterfaceAndroid User Interface
Android User Interface
 
Ado.Net Tutorial
Ado.Net TutorialAdo.Net Tutorial
Ado.Net Tutorial
 
Android intent
Android intentAndroid intent
Android intent
 
Snmp
SnmpSnmp
Snmp
 
Introduction to Android ppt
Introduction to Android pptIntroduction to Android ppt
Introduction to Android ppt
 
M2M vs IoT: The Key Differences and Similarities
M2M vs IoT: The Key Differences and SimilaritiesM2M vs IoT: The Key Differences and Similarities
M2M vs IoT: The Key Differences and Similarities
 
Notification android
Notification androidNotification android
Notification android
 
Unit 4
Unit 4Unit 4
Unit 4
 

Similar to Mobile Application Development MAD J2ME UNIT 2

Session 3 J2ME Mobile Information Device Profile(MIDP) API
Session 3 J2ME Mobile Information Device Profile(MIDP)  APISession 3 J2ME Mobile Information Device Profile(MIDP)  API
Session 3 J2ME Mobile Information Device Profile(MIDP) APImuthusvm
 
J2me Crash Course
J2me Crash CourseJ2me Crash Course
J2me Crash Courseguest860a03
 
Java ME CLDC MIDP
Java ME CLDC MIDPJava ME CLDC MIDP
Java ME CLDC MIDPSMIJava
 
010118565.pdf
010118565.pdf010118565.pdf
010118565.pdfEidTahir
 
Introduction to mobile programing (J2ME)
Introduction to mobile programing (J2ME)Introduction to mobile programing (J2ME)
Introduction to mobile programing (J2ME)Wambua Wambua
 
Basic of Android App Development
Basic of Android App DevelopmentBasic of Android App Development
Basic of Android App DevelopmentAbhijeet Gupta
 
Introduction to j2me
Introduction to j2meIntroduction to j2me
Introduction to j2meFae Kaal
 
Android architecture
Android architectureAndroid architecture
Android architectureDeepa Rahul
 
Introduction To J2ME(FT - Prasanjit Dey)
Introduction To J2ME(FT - Prasanjit Dey)Introduction To J2ME(FT - Prasanjit Dey)
Introduction To J2ME(FT - Prasanjit Dey)Fafadia Tech
 
"MIDP 3.0 Master Class"
"MIDP 3.0 Master Class""MIDP 3.0 Master Class"
"MIDP 3.0 Master Class"paulsu
 
Github-Source code management system SRS
Github-Source code management system SRSGithub-Source code management system SRS
Github-Source code management system SRSAditya Narayan Swami
 
2 mobile development frameworks and tools dark temp
2   mobile development frameworks and tools dark temp2   mobile development frameworks and tools dark temp
2 mobile development frameworks and tools dark tempShahid Riaz
 

Similar to Mobile Application Development MAD J2ME UNIT 2 (20)

Session 3 J2ME Mobile Information Device Profile(MIDP) API
Session 3 J2ME Mobile Information Device Profile(MIDP)  APISession 3 J2ME Mobile Information Device Profile(MIDP)  API
Session 3 J2ME Mobile Information Device Profile(MIDP) API
 
J2me Crash Course
J2me Crash CourseJ2me Crash Course
J2me Crash Course
 
03 midp
03 midp03 midp
03 midp
 
06 Eclipse ME
06 Eclipse ME06 Eclipse ME
06 Eclipse ME
 
Scmad Chapter03
Scmad Chapter03Scmad Chapter03
Scmad Chapter03
 
Java ME CLDC MIDP
Java ME CLDC MIDPJava ME CLDC MIDP
Java ME CLDC MIDP
 
010118565.pdf
010118565.pdf010118565.pdf
010118565.pdf
 
Introduction to mobile programing (J2ME)
Introduction to mobile programing (J2ME)Introduction to mobile programing (J2ME)
Introduction to mobile programing (J2ME)
 
J2ME
J2MEJ2ME
J2ME
 
Lab 1 new
Lab 1 newLab 1 new
Lab 1 new
 
Session 2 beccse
Session 2 beccseSession 2 beccse
Session 2 beccse
 
Basic of Android App Development
Basic of Android App DevelopmentBasic of Android App Development
Basic of Android App Development
 
J2me Platform
J2me PlatformJ2me Platform
J2me Platform
 
Introduction to j2me
Introduction to j2meIntroduction to j2me
Introduction to j2me
 
Android architecture
Android architectureAndroid architecture
Android architecture
 
Introduction To J2ME(FT - Prasanjit Dey)
Introduction To J2ME(FT - Prasanjit Dey)Introduction To J2ME(FT - Prasanjit Dey)
Introduction To J2ME(FT - Prasanjit Dey)
 
"MIDP 3.0 Master Class"
"MIDP 3.0 Master Class""MIDP 3.0 Master Class"
"MIDP 3.0 Master Class"
 
Github-Source code management system SRS
Github-Source code management system SRSGithub-Source code management system SRS
Github-Source code management system SRS
 
2 mobile development frameworks and tools dark temp
2   mobile development frameworks and tools dark temp2   mobile development frameworks and tools dark temp
2 mobile development frameworks and tools dark temp
 
J2ME Unit_01
J2ME Unit_01J2ME Unit_01
J2ME Unit_01
 

More from Pallepati Vasavi

MOBILE COMPUTING MANETS,ROUTING ALGORITHMS
MOBILE COMPUTING MANETS,ROUTING ALGORITHMSMOBILE COMPUTING MANETS,ROUTING ALGORITHMS
MOBILE COMPUTING MANETS,ROUTING ALGORITHMSPallepati Vasavi
 
MOBILE COMPUTING Unit-3,Mobile IP
MOBILE COMPUTING Unit-3,Mobile IPMOBILE COMPUTING Unit-3,Mobile IP
MOBILE COMPUTING Unit-3,Mobile IPPallepati Vasavi
 
Mobile computing unit2,SDMA,FDMA,CDMA,TDMA Space Division Multi Access,Frequ...
Mobile computing unit2,SDMA,FDMA,CDMA,TDMA  Space Division Multi Access,Frequ...Mobile computing unit2,SDMA,FDMA,CDMA,TDMA  Space Division Multi Access,Frequ...
Mobile computing unit2,SDMA,FDMA,CDMA,TDMA Space Division Multi Access,Frequ...Pallepati Vasavi
 
Mobile computing-Unit 1,GSM
Mobile computing-Unit 1,GSMMobile computing-Unit 1,GSM
Mobile computing-Unit 1,GSMPallepati Vasavi
 
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...Pallepati Vasavi
 

More from Pallepati Vasavi (6)

MOBILE COMPUTING MANETS,ROUTING ALGORITHMS
MOBILE COMPUTING MANETS,ROUTING ALGORITHMSMOBILE COMPUTING MANETS,ROUTING ALGORITHMS
MOBILE COMPUTING MANETS,ROUTING ALGORITHMS
 
Mobile Transport layer
Mobile Transport layerMobile Transport layer
Mobile Transport layer
 
MOBILE COMPUTING Unit-3,Mobile IP
MOBILE COMPUTING Unit-3,Mobile IPMOBILE COMPUTING Unit-3,Mobile IP
MOBILE COMPUTING Unit-3,Mobile IP
 
Mobile computing unit2,SDMA,FDMA,CDMA,TDMA Space Division Multi Access,Frequ...
Mobile computing unit2,SDMA,FDMA,CDMA,TDMA  Space Division Multi Access,Frequ...Mobile computing unit2,SDMA,FDMA,CDMA,TDMA  Space Division Multi Access,Frequ...
Mobile computing unit2,SDMA,FDMA,CDMA,TDMA Space Division Multi Access,Frequ...
 
Mobile computing-Unit 1,GSM
Mobile computing-Unit 1,GSMMobile computing-Unit 1,GSM
Mobile computing-Unit 1,GSM
 
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
JDBC,Types of JDBC,Resultset, statements,PreparedStatement,CallableStatements...
 

Recently uploaded

ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationAadityaSharma884161
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfSpandanaRallapalli
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 

Recently uploaded (20)

ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
ROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint PresentationROOT CAUSE ANALYSIS PowerPoint Presentation
ROOT CAUSE ANALYSIS PowerPoint Presentation
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
ACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdfACC 2024 Chronicles. Cardiology. Exam.pdf
ACC 2024 Chronicles. Cardiology. Exam.pdf
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 

Mobile Application Development MAD J2ME UNIT 2

  • 1. Unit-II J2ME Architecture  Small Computing Device Requirements Run-Time Environment  MIDlet Programming Java Language for J2ME  J2ME Software Development Kits  Hello World J2ME Style Multiple MIDlets in a MIDlet Suite J2ME Wireless Toolkit
  • 3. 1. J2ME architecture  The design of j2me architecture provides the scalability to an application based on the constraints of the small computing devices.  J2me architecture does not replace the operating system of small computing devices J2me architecture consists of layers located above the native operating system.
  • 4. J2ME architecture Three layers 1. Configuration layer- includes the jvm, which interacts the operating system. and also interacts the profiles and jvm. 2. Profile layer- it provides the java API used to implement the applications for the small computing devices. 3. MIDP- provides classes for the network connections, user interface and persistent storage. small computing devices has two components provided by the original equipment manufacturers. 1. OEM classes- these are used by the MIDP to access the features of the specific device such as sending and receiving messages and access persistent storage. 2. OEM applications- these can be accessed by the MIDP such as address book. Note:- these components are not portable since all the small computing devices does not use the same OEM classes and OEM applications.
  • 5. 2. Small computing device requirements • Hardware requirements - display 96 X 54 pixel should supports the bitmapped pixels. - key pad, keyboard, or touch screen for input - ROM - 128KB to run the Mobile information Device (MID) - 8KB for permanent storage like applications data. - RAM - 32KB to run JVM - device must provide the two way network connectivity (SIM) • software requirements - native operating system ( which is supported by specific system) - it must includes the exception handling, scheduling, process interrrupts, ability to run the JVM - file system does not required to run the JVM - able to read and write permanent data on to the nonvolatile memory.
  • 6. 3. Run time environment • MIDlet( MIDP applications ) - is a J2ME program specific for the J2ME virtual machine to run applications on small computing devices like cellphones.  MIDlet has atleast one class that is derived from the javax.microedition.midlet.MIDlet abstract class.  MIDlet required the device which implements with the J2ME, MIDP to run.  MIDlet are compiled once and run anywhere  a group of MIDlet are packed into MIDlet suit.  MIDlet suite uses the same instance of java class and run within the same JVM.
  • 7.  Advantage of MIDlet suite is that all the MIDlets which are belong to same MIDlet suite share the same data so it reduces the data errors during the concurrent read and write access to a data.  MIDlet suit installed, executed and removed by the application manager which is provided by the manufactures and run on the device.  Once this is installed on the device each member of the MIDlet suit can have access to the classes and methods of the JVM and CLDC ( configuration layer) bye the application manager.  MIDlet suite consists of two files 1. .JAR file 2. .JAD file .JAR file- it contains compiled classes in a compressed and preverified manner. - several MIDlets are included in the MIDlet suite all its classes are includes in the .JAR file. - and also includes the graphics images and the manifest file.
  • 8. JAR  All the files necessary to implement a MIDlet suite must be contained within a production package called a Java archive (JAR) file.  These files include MIDlet classes, graphic images (if required by a MIDlet), and the manifest file.  The manifest file contains a list of attributes and related definitions that are used by the application manager to install the files contained in the JAR file onto the small computing device.  Nine attributes are defined in the manifest file; all but six of these attributes are optional.
  • 9. Manifest file- list of attributes and definitions used by the application. - nine attributes define in Manifest file, six are mandatory Attributes of the manifest file
  • 10. • Go to project folder, see bin folder and open manifest file. MIDlet-2: HelloWorld, , hello. HelloWorldMIDlet-1: HelloMIDlet, , hello. HelloMIDletMIDlet-Vendor: Vendor MIDlet-Name: MobileApplication5 MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.1 MicroEdition-Profile: MIDP-2.0
  • 11. JAD file • A JAD file is also used to provide the application manager with additional content information about the JAR file to determine whether the MIDlet suite can be implemented on the device. • All JAD files must have the .jad extension • A JAD file is similar to a manifest in that both contain attributes that are name:value pairs. Name:value pairs can appear in any order within the JAD file. There are five required system attributes for a JAD file:
  • 12. JAD file • MIDlet-Name • MIDlet-Version • MIDlet-Vendor • MIDlet-n • MIDlet-Jar-URL • The first three attributes in the JAD file are identical to attributes in the manifest file.
  • 13.
  • 14. MIDlet-1: HelloMIDlet, , hello.HelloMIDlet MIDlet-2: HelloWorld, , hello.HelloWorld MIDlet-Jar-Size: 2354 MIDlet-Jar-URL: MobileApplication5.jar MIDlet-Name: MobileApplication5 MIDlet-Vendor: Vendor MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.1 MicroEdition-Profile: MIDP-2.0
  • 15. • C:Documents and settingsAdministratorj2mewtk2.5.2appssnistbin • in bin folder you can find manifest file and jad file • to create jar file – goto sun java wirelss tool kit 2.5.2-> project-> create package • then jar would created in the bin folder, extract file it includes manifest file, .class file and images with .png extension.
  • 16. MIDlet Programming • Programming a MIDlet is similar to creating a J2SE application in that define a class and related methods • Less Robust • A MIDlet is a class that extends the MIDlet class and is the interface between application statements and the run-time environment, which is controlled by the application manager.
  • 17. MIDP Applications (MIDlets) and MIDlet Lifecycle • When j2me application (MIDlet) is created it must extended from the MIDlet class in javax.microedition.midlet.MIDlet • MIDlet class as three abstract methods that are called by the Application manager software (AMS). • When MIDlet starts to run, it goes into three phases which are controlled by the AMS. 1.pasueApp() 2. startApp() 3. destroyApp();
  • 18. Stages of MIDlet's lifecycle 1. When the MIDlet is about to be run, an instance of javax.microedition.midlet.MIDlet class is created. The MIDlet's class constructor with 0 arguments is run, and the MIDlet is in the Paused state. 2. Next, MIDlet move into Active state after application manager calling startApp() method which implement with extend MIDlet class. 3. While the MIDlet is Active state, the application manager can suspend its execution by calling pauseApp() method 4. After application manager execute startApp() method, can terminate the execution by calling destroyApp() method. 5. A MIDlet can destroy itself by calling notifyDestroyed() method.
  • 19. • public class HelloWorld extends MIDlet { public void startApp() { } public void pauseApp() { } public void destroyApp( boolean unconditional ) { } }
  • 20. • Both the startApp() and pauseApp() methods are public and have no return value nor parameter list. • The destroyApp() method is also a public method without a return value. • However, the destroyApp() method has a boolean parameter that is set to true if the termination of the MIDlet is unconditional and false if the MIDlet can throw a MIDletStateChangeException telling the application manager that the MIDlet does not want to be destroyed just yet.
  • 21. • At the center of every MIDlet are the MIDP API classes used by the MIDlet to interact with the user and handle data management. • User interactions are managed by user interface MIDP API classes. • These APIs enable a developer to display screens of data and prompt the user to respond with an appropriate command. The command causes the MIDlet to execute oneof three routines: perform a computation, make a network request, or display another screen.
  • 22. • The data-handling MIDP API classes enable the developer to perform four kinds of data routines: • write and read persistent data, store data in data types, receive data from and send data to a network, and interact with the small computing device’s input/output features.
  • 23. Event Handling • A MIDlet is an event-based application. • All routines executed in the MIDlet are invoked in response to an event reported to the MIDlet by the application manager. • The initial event that occurs is when the MIDlet is started and the application manager invokes the startApp() method. • The startApp() method in a typical MIDlet contains a statement that displays a screen of data and prompts the user to enter a selection from among one or more options. The nature and number of options is MIDlet and screen dependent.
  • 24. Event Handling • A Command object is used to present a user with a selection of options to choose from when a screen is displayed. • Each screen must have a CommandListener. • A CommandListener monitors user events with a screen and causes the appropriate code to execute based on the current event.
  • 25. User interfaces • Some small computing devices contain resources that provide a rich user interface, while other more resource- constrained devices offer a modest user interface. • A rich user interface contains the following elements, and a device with a minimal user interface has some subset of these elements as determined by the profile used for the device. • A Form is the most commonly invoked user interface element found in a MIDlet and is used to contain other user interface elements. Text is placed on a form as a StringItem, a List, a ChoiceGroup, and a Ticker
  • 26. • A StringItem contains text that appears on a form that cannot be changed by the user. • A List is an itemized options list from which the user can choose an option. • A ChoiceGroup is a related itemized options list. • And a Ticker is text that is scrollable. • A user enters information into a form by using the Choice element, TextBox, TextField, or DateField elements. • The Choice element returns an option that the user selected. User interfaces
  • 27. User interfaces • TextBox and TextField elements collect textual information from a user and enable the user to edit information that appears in these user interface elements. • The DateField is similar to a TextBox and TextField except its contents are a date and time • An Alert is a special Form that is used to alert the user that an error has occurred. An Alert is usually limited to a StringItem user interface element that defines the nature of the error to the user
  • 28. Device Data • A MIDlet can use an MIDP class—RecordStore—and two MIDP interfaces— RecordComparator and RecordFilter—to write and read persistent data. • A RecordStore class contains methods used to write and read persistent data in the form of a record. • Persistent data is read from a RecordStore by using either the RecordComparator interface or the RecordFilter interface
  • 29. Java Language for J2ME • CDC implements the full J2SE available, but CLDC implements a stripped-down J2SE • Floating-point math is probably the most notable missing feature of J2ME. MIDlet cannot use any floating-point data types or calculations. • Absence of support for the finalize() method • Reduced number of error-handling exceptions • Changes were also made in the Java Virtual Machine that runs on a small computing device because of resource constraints. One such change occurs with the class loader. JVM for small computing devices requires a custom class loader that is supplied by the device manufacturer and cannot be replaced or modified. • Another feature lacking in the JVM is the ThreadGroup class. You cannot group threads.
  • 30. • Two other features of J2SE that are missing from J2ME are weak references and the Reflection classes • The standard JVM uses class file verification to protect applications from malicious code through the use of a security manager. However, this process is replaced with a two-step process because of the limited resources available on small computing devices
  • 31.
  • 32. J2ME Software Development Kits • A MIDlet is built using free software packages that are downloadable from the java.sun .com • Although we can purchase third-party development products such as Borland JBuilder Mobile Set, Sun One Studio 4 (formerly Forte for Java), and WebGain VisualCafe Enterprise Suite. • Three software packages need to be downloaded from java.sun.com. • Java Development Kit (1.3 or greater) (java.sun.com/ j2se/downloads.html), • Connected Limited Device Configuration (CLDC) (java.sun. com/products/cldc/), • Mobile Information Device Profile (MIDP) (java.sun.com/ products/midp/). • And also need the J2ME Wireless Toolkit to develop MIDlets for handheld devices (java.sun.com/products/j2mewtoolkit/download.html).
  • 33. • Install the CLDC once the Java development kit is installed. • Unzip the downloaded CLDC files fromthe java.sun.com web site onto the d:j2me directory(J2ME_HOME) on your computer. • You’ll need to create the j2me directory if one doesn’t exist. Unzipping the CLDC package creates the j2me_cldc subdirectory below the j2me directory • Each platform is in its own subdirectory under j2me_cldc. Add the j2mej2me_cldcbinwin32 subdirectory to the PATH environment variable • Next, download and unzip the MIDP file. Be sure to use j2me as the directory for the MIDP file. Unzipping the MIDP file creates a midp directory. • you’ll need to include the j2memidp1.0.3fcsbin subdirectory in the PATH environment variable. Installation and setting paths
  • 34. • Next, create two environment variables. These are CLASSPATH and MIDP_HOME. • The CLASSPATH environment variable identifies the path to be searched whenever a class is invoked. • Set the CLASSPATH to d:j2memidp1.0.3fcsclasses; • The MIDP_HOME environment variable identifies the location of the lib directory that contains the internal.config file and the system.config file. • Set the MIDP_HOME environment variable to d:j2memidp1.0.3fcs
  • 35. creating a directory structure within which you can create and run MIDlets • J2me • j2mesrc • j2mesrcgreeting • j2metmp_classes • j2memidlets
  • 36.
  • 37. HelloWorld Example • The HelloWorld MIDlet performs three basic functions that are found in nearly all MIDlets. These are to display a text box and a command on the screen, then listen to events that occur while the MIDlet is running • The HelloWorld MIDlet is created by defining a class called HelloWorld that extends the MIDlet class and implements a CommandListener. • The HelloWorld class contains three private data members and four methods. The data members are a Display object, a text box, and a command. The methods are startApp(), pauseApp(), and destroyApp(). The fourth method is called commandAction() and is invoked by the application manager whenever an event occurs • Twopackages must be imported at the beginning of the MIDlet to access MIDlet classes and lcdui classes. • MIDlet classes are screen oriented and create a Display object and then place components of the screen into the Display object
  • 38. • The startApp() method contains the necessary statements to invoke previously defined objects • Calling getDisplay multiple times always returns the same Display reference for the specified MIDlet. • An instance of a command object is created. Command- a label, a type, and a priority Label- string Type- specifies type of the command - BACK,EXIT,CANCEL,OK,SCREEN,ITEM,HELP,STOP. Priority- importance of the command with the other commands on the screen. it may be integer. The last instance is TextBox object. Four values are necessary to create an instance of a TextBox object. The first is the caption for the TextBox object followed by the text that will appear in the TextBox object. The other two values are coordinates used by the application manager to position the TextBox object on the screen
  • 39. Compiling Hello World • Make j2mesrcgreeting the current directory • javac -d d:j2metmp_classes -target 1.1 -bootclasspath d:j2memidp1.0.3fcsclasses HelloWorld.java • The bootclasspath option points to the startup class files commonly referred to as the Java bootstrap files. • Next, you’ll need to preverify the HelloWorld.class that was generated by the compiler. Make sure that j2mesrcgreeting is the current directory and enter the following command: • preverify -d d:j2meclasses -classpath d:j2memidp1.0.3fcsclasses d:j2metmp_classes • The -d option places the class file within the tmp_classes directory. The second option is -classpath, which points to the location of the library classes that come with the MIDP.
  • 40. Running HelloWorld • There are two ways to run a MIDlet. These are either by invoking the MIDlet class or by creating a JAR file, then running the MIDlet from the JAR file. • Make sure that j2mesrc greeting is the current directory, and then enter the following command • midp -classpath d:j2meclasses greeting.HelloWorld
  • 41. Deploying HelloWorld • The MIDlet suite is then packaged into a JAR file along with other related files for downloading to a small computing device. This process is commonly referred to as packaging • create the manifest file • MIDlet-1: HelloWorld, , greeting.HelloWorld • MIDlet-Name: Hello World • MIDlet-Version: 1.0 • MIDlet-Vendor: Jim • MIDlet-1: HelloWorld, /greeting/myLogo.png, greeting.HelloWorld MicroEdition-Configuration: CLDC-1.0 • MicroEdition-Profile: MIDP-1.0 • create the JAR file once the manifest.txt file is saved in the j2mesrc greeting directory.
  • 42. • create the JAR file by entering the following command: • jar -cfvm d:j2memidletsHelloWorld.jar manifest.txt -C d:j2meclasses greeting • Create the JAD file • MIDlet-Name: Hello World • MIDlet-Version: 1.0 • MIDlet-Vendor: Jim • MIDlet-Description: My First MIDlet suite • MIDlet-1: HelloWorld, /greeting/myLogo.png, greeting.HelloWorld MIDlet-Jar-URL: HelloWorld.jar • MIDlet-Jar-Size: 1428 • Copy the HelloWorld.jad file into the j2me/midlets directory • Then make j2me/midlets the current directory. • Invoke the MIDlet by entering the following command. • midp -classpath HelloWorld.jar -Xdescriptor HelloWorld.jad
  • 43. Packages available in J2ME • Java.lang • Java.io • Java.util • Javax.microedition.io • Javax.microedition.lcdui • Javax.microedition.midlet. • Javax.microedition.rms.
  • 44. Javax.microedition.lcdui- provides a set of features for implementation of user interfaces for MIDP applications. • Interfaces 1. Choice 2. CommandListener 3. ItemStateListener classes 1. Alert 2. Command 3. Display 4. Displayable 5. Form 6. Font 7. Image 8. TextBox etc
  • 45. Javax.microedition.midlet. MIDlet package defines Mobile Information Device Profile applications and the interactions between the application and the environment in which the application runs. Classes 1. MIDlet Exception MIDletStateChangeException
  • 46. Display- manger of the display and input device of the system. MIDlet classes are screen oriented - 1st create the Display object on which we can place all the components of the screen into the Display object - this display object calling the method getDisplay().to display the screen on the small computing devices. - setCurrent()- The Display class has a setCurrent() method for setting the current Displayable ( Form) Displayable- objects that are capable of being placed on the display ex- Form, Command all are Displayable objects. Form- A Form is a Screen that contains an arbitrary mixture of items: images, read-only text fields, editable text fields notifyDestroyed(); - Used by an MIDlet to notify the application management software that it has entered into the Destroyed state.
  • 47. Command- a label, a type, and a priority Label- string Type- specifies type of the command - BACK,EXIT,CANCEL,OK,SCREEN,ITEM,HELP,STOP. Priority- importance of the command with the other commands on the screen. it may be integer. - commandAction( Command c, Displayable d) * this method in interface CommandListener * Indicates that a command event has occurred on Displayable d.
  • 48. Multiple MIDlets in a MIDlet Suite  add multiple MIDlets to the MIDlet Suite  AMS displays the MIDlets in menu option and enables the user to run one MIDlet at a time.  How to create MIDlet Suite step-1 : open sun_java_wireless toolkit and click on settings
  • 49. Step-2 : click on MIDlets and click add button
  • 50. Java Language for J2ME  Floating- point math not available on J2ME. - special processor hardware required for the float point calculations but small computing devices lack in hardware - MIDlet cannot support floating point calculations  Absence of Finalize() method  Fewer error handling exceptions - error handling exceptions grabs the system resources which are very less in small computing devices. - run time exceptions are handled by the underlying native operating system.  Weak references and no reflection classes.  Some changes made in the JVM which runs on small computing devices 1. class loader: JVM of small computing devices have custom class loader that is supplied by the manufactures only those cannot be modified or replaced 2. Thread group class: threads cannot be grouped. All the threads handled by the object level.  J2SE uses the file verification to protect from malicious code through the use of a security manager. whereas, in J2ME this took place in two steps 1. preverification- done outside of the small computing devices before loading MIDlet 2. MIDlet class loaded on to the device and verifier in small computing devices validates each instruction in the MIDlet class.
  • 51. Alert- it is screen that shows the data to the user and wait for some time to process the next displayable. - it contains text and images. AlertType.INFO- provides non threatening information to the user.
  • 52. J2ME Wireless Toolkit • J2ME Wireless Toolkit that is downloadable from java.sun.com/products/j2mewtoolkit/download.html. • It is used to develop and test J2ME applications by selecting a few buttons from a toolbar • J2ME Wireless Toolkit is a stripped-down integrated development environment in that it does not include an editor, a full debugger, and other amenities found in a third-party integrated development environment. • Building and Running a Project • Ktoolbar is the executable within the directory that launches the Toolkit. The main window is displayed when you run ktoolbar
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58. Step- 3 : click ok button on Enter MIDlet Details
  • 59. Step -4 : Click ok
  • 60. Step- 5: go to project (MIDlet suite) to which you added MIDlets and open manifest file in bin folder. MIDlet-1: ExampleTb, ExampleTb.png, ExampleTb MIDlet-2: MidletLifecycle, MidletLifecycle.png, MidletLifecycle MIDlet-Name: TextBoxEx MIDlet-Vendor: Unknown MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.0 MicroEdition-Profile: MIDP-2.0
  • 61. Step- 6 : place MIDlets in the src folder of the MIDlet Suite
  • 62. Step – 7 : build the project step- 8 : run project
  • 63. JAVA ME SDK • The Oracle Java, Micro Edition (Java ME) Software Development Kit (SDK) provides device emulation, a standalone development environment and a set of utilities for rapid development of Java ME applications. • It integrates the Connected Limited Device Configuration (CLDC) and the Connected Device Configuration (CDC) technology into one simple development environment. • The Java ME SDK is a successor to the Sun Java Wireless Toolkit and the Java Toolkit for CDC and offers improved device emulation, a standalone lightweight development environment, and powerful tools to speed application development.
  • 64. Key Features: • A single SDK for application development for the full range of Java ME device targets • Built-in emulators for application prototyping • Customizable device skins for your development environment • NetBeans and Eclipse plugins for better IDE integration • On-device tooling for remote application management and debugging • Application profiling, network monitoring, and memory monitoring •