站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Programming Wireless Devices with the Java2 Platform

Programming Wireless Devices with the Java2 Platform

[ directory ] Previous Section Next Section

20.2 System Properties

MIDP inherits the system property mechanism from CLDC (see Section 5.2.10, "Property Support"). In addition to the properties provided by the CLDC, the MIDP Specification defines the following additional properties that can be retrieved by calling the method java.lang.System.getProperty (see Table 20.1).

The microedition.locale property is a String that consists of the language, country code, and variant separated by "-" (Unicode U+002D), for example, "fr-FR" or "en-US". Note that this is different from the J2SE definition for Locale printed strings where fields are separated by "_" (Unicode U+005F).

Table 20.1. System properties defined by MIDP

System Property

Description

microedition.locale

The current locale of the device; may be null.

microedition.profiles

A blank (Unicode U+0020) separated list of the J2ME profiles that this device supports. For MIDP 2.0 devices, this property MUST contain at least "MIDP-2.0".

graphics/new_icon.gif microedition.commports

A comma separated list of ports that can be combined with a "comm:" prefix as the URL string to be used to open a serial port connection (see Section 15.8, "CommConnection").

microedition.hostname

The local hostname (if available).

This locale string can be used by a MIDlet to determine the locale for which the underlying device is configured.

The microedition.profiles property can be used by a MIDlet to ensure that the underlying platform supports the necessary profile(s) and profile version(s) that the application requires.

    [ directory ] Previous Section Next Section