Namespaces
Variants
Actions

Displaying the correct MIDlet version in an About dialog

Jump to: navigation, search
SignpostIcon Code 52.png
Article Metadata

Article
Created: valery_bogdanov (24 May 2007)
Last edited: hamishwillee (23 Jul 2012)

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 23 July 2012, at 07:34.
116 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved