×
Namespaces

Variants
Actions

Displaying the correct MIDlet version in an About dialog

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: valery_bogdanov (24 May 2007)
Last edited: hamishwillee (16 Aug 2013)

This code snippet shows how to get the current version of the MIDlet for use in the app "About" dialog.

Novice Java ME developers often hard code the application version in the app About dialog. This is a mistake because it is easy for this value to get out of sync with the version in the JAD file (and thereby confuse end-users). To prevent such errors it is good practice to use the actual application version, taken from JAD file (or JAR file, if the JAD is absent).

Just use following code:

import javax.microedition.midlet.MIDlet;
 
public class MyMIDlet extends MIDlet {
 
public String getAppVersion() {
return this.getAppProperty("MIDlet-Version");
}
}
This page was last modified on 16 August 2013, at 04:13.
43 page views in the last 30 days.
×