Some Simple Text Effects in Java ME

January 12th, 2008

The Graphics.drawString() method in MIDP is pretty limited. You can specify a position, anchor point, and with the help of Graphics.setColor() and Graphics.setFont(), a color and a font, but that’s about it. However, its possible to do some simple text effects that are a bit more interesting by combining multiple calls to drawString().


Filtering and Ordering Records with RMS

October 13th, 2007

If you’ve ever used the Record Management System mechanism in MIDP, you already know how useful the RecordStore class can be for storing persistent data. In a previous tutorial, Using RMS to Store Persistent Data, we used the RecordStore.getRecord(int) method to retrieve a record by its ID. However, sometimes you may have more complex retrieval criteria than simply the record ID. That’s where the enumerateRecords() method comes in handy. In this article we will discuss how to filter and order a subset of records in a RecordStore object using enumerateRecords()


Using the Mobile Media API to Play Video

August 13th, 2007

The Mobile Media API (JSR-135) specification enables advanced audio and video support on Java ME devices. While MIDP 2.0 supports a subset of the MMAPI, this subset does not include the video or graphics components of the specification. In this article, we will look at a simple example of how to play video on a MMAPI enabled device.


Text Messaging and the Wireless Messaging API

July 16th, 2007

Short Message Service (SMS), commonly referred to as Text Messaging, allows cell phone users to send short, plain-text messages to each other. The Wireless Messaging API (WMA) is an optional Java ME package that provides programmatic support for messaging technologies such as SMS. In this article we will look at how to use WMA to send SMS messages.


Using MIDP Localization to Support Multiple Languages

June 4th, 2007

In today’s global economy, it is now more important than ever for software to be written with localization in mind, and mobile applications are no exception. Thankfully, NetBeans Mobility Pack makes the task easier with built-in support for MIDP localization. In this article we will take a look at MIDP localization, and how NetBeans helps us implement localized applications.


Asynchronous Processing in Java ME: The Push Registry

May 14th, 2007

When writing mobile applications, you may encounter situations where you need to execute logic independently of user interaction. For example, your application may need to do something in response to an outside event, such as an e-mail message being received. You could put a loop in your application that periodically checks to see if the conditions for performing the task have been met. However, even if it were supported by the device, this approach could consume valuable resources. A better solution is to use the push registry API, which was added in MIDP 2.0. In this article we will take a look at the features and limitations of the push registry.


Working with the TiledLayer Class

May 6th, 2007

A common technique used in video games is to have a large scrolling background formed by a grid of smaller, reusable images. In MIDP 1.0, such a feature would need to be implemented from scratch or with a third-party library. However, MIDP 2.0 provides the convenient TiledLayer class to address this specific need. In this article we will look at a simple example of how to use the TiledLayer class in a Java ME application.


Using Preprocessor Directives to Port Java ME Applications

April 1st, 2007

There may be times when you want to take advantage of device-specific features, yet support as wide a selection of devices as possible. For example, perhaps you want to play sound in your application, but you also want to target several different platforms, each with different APIs for playing sounds. You could manually create a new project for each device you wish to support, but that could quickly turn into a nightmare as you try to keep common code in sync. That’s where preprocessor directives come in. This handy feature allows you to insert conditional logic into your source files that will include or exclude blocks of code before it gets to the Java compiler.


Floating Point Support in Java ME

March 17th, 2007

Anyone who has been writing Java ME (J2ME) applications for a while has probably run into one of the more frustrating limitations of the platform, lack of support for the floating point primitive types: float and double. More accurately, there is no floating point support in CLDC 1.0. If you can, use CLDC 1.1, which does have floating point support. If that’s not a viable option, another possibility is to use one of the fixed point math libraries that are freely available, or to roll your own solution.


Sinfah’s Lair Reaches 20,000 Downloads

March 16th, 2007

Sinfah's Lair for Java Enabled Cell Phones

Sinfah’s Lair reached the 20,000 download mark today on GetJar. Many thanks to everyone who has played and provided feedback!