Programming Tutorials

J2ME Tutorials

1. Is J2ME dead?

By: Niraj : 2023-05-02

Description: J2ME (Java 2 Micro Edition) is a platform that allows developers to build mobile and embedded applications that can run on resource-constrained devices. Although its popularity has decreased in recent years due to the emergence of more powerful mobile operating systems and frameworks, J2ME is still used in some specific use cases, including


2. GUI components and menu based J2ME Applications.

By: Fazal : 2022-09-16

Description: The central abstraction of the MIDP UI is a screen, which is an object that encapsulates device-specific graphics rendering user input. Only one screen can be visible at a time, and the user can traverse only through the items on that screen.


3. Code sample to Send SMS from a J2ME application.

By: Leon : 2010-07-30

Description: A java application, where on making a Push to talk call, and the call does not get matured due the the callers phone being busy in another call, busy in packet data, switched off or not in coverage, the java appplication installed in the callers phone should send out a sms, automatically to the called number. The number to send the SMS is taken from the phone book for the called number.


4. Adding your own Application icon for your J2ME application (jar file)

By: Emiley J. : 2009-05-29

Description: Normally it is the default icon which is seen as soon as the installation of a jar file is complete.. if you want to see your own icon for launching the application after installing the jar file then here is how you can do this.


5. Play a multimedia file in J2ME Program (Audio/Video) using MMAPI

By: Vikram Goyal : 2008-08-18

Description: The simplest MMAPI MIDlet that can be built allows you to easily play a multimedia file from within your MIDlet without worrying about controls, feature sets, or security architecture. If all you're doing is adding some sampled audio (or any other media) in a game, MMAPI allows you to do so in two lines of code. Listing below shows this code within a complete MIDlet.


6. Datagrams in J2ME (UDP Programming sample)

By: David Hemphill : 2008-08-01

Description: It is quite possible for someone to have worked with Java for some time without ever needing to understand or use datagrams. For mobile devices, however, datagrams offer some advantages in that they are rather lightweight when compared to TCP-based connections such as sockets. User Datagram Protocol, UDP, is one of the more common datagram protocols. However, because most datagram protocols follow the same basic principals as to their usage, the GCF is able to support datagrams generically.


7. Client Server in J2ME (Socket Programming sample)

By: David Hemphill : 2008-08-01

Description: Sockets are different than datagrams because they use a connection-based paradigm to transmit data. This means that both a sender and a receiver must be running and establish a communication channel for data to be exchanged. To use a real-world analogy, a socket connection is like calling a friend on the telephone. If the friend does not answer, a conversation cannot take place. Datagrams on the other hand are more like sending a letter to a friend, where a note is placed into an envelope, addressed, and mailed.


8. Using HttpConnection in J2ME (Retrieve web content from a website to a phone)

By: David Hemphill : 2008-08-01

Description: This J2ME example will cover reading data using the MIDP HttpConnection. Note that this connection interface is not part of the CLDC or CDC, but is defined rather in the MIDP and Personal Profiles themselves. The behavior of HttpConnection is one that combines an InputStream and an OutputStream into a single connection. A single HttpConnection may open and use exactly one OutputStream and exactly one InputStream. The order in which the streams are used is important as well. The OutputStream, if used, must be used before the InputStream. Once the streams have been used the connection should be closed and a new HttpConnection should be opened to continue communications if necessary. This follows the HTTP request-response paradigm.


9. Using HTTP vs UDP vs Socket in J2ME

By: David Hemphill : 2008-08-01

Description: In the case of MIDP, the specification only requires support for HTTP, although many devices support datagrams and sockets as well, because these protocols are needed to implement HTTP. However, before making commitments to datagrams or sockets it is a good idea to make sure they are supported on the platforms you are targeting.


10. RMSCookieConnector - Using Cookies in J2ME

By: Michael Juntao Yuan and Ju Long : 2008-08-01

Description: The RMSCookieConnector class stores cookies in an RMS record store. An RMS record store is accessed by its name, rather than reference, and can persist between soft resets, or reboots. That ensures an old session remains valid when a user later returns to an application after previously quitting it. Considering most people use their mobile information devices for many different tasks simultaneously, cookie persistence is a desired feature.