Setting Parameters in the _defaults_.xml and Target Device Files
To add parameters to the project’s _defaults_.xml or one of the project’s target device files (device_name.xml), use the following format:
<param name="ParameterName" value="ParameterValue"/>
You can also optionally include a comment when setting the parameter:
<param name="ParameterName" value="ParameterValue" comment="comment"/>
Specifying the Parameter Name
For ParameterName specify the name you want to use. The name can be anything that is acceptable as a Java variable.
Specifying the Parameter Value
For ParameterValue use one of the formats specified in the following table.
For this type of value... | Use this format to specify the value... |
boolean | boolean={"true" | "false"} or bool={"true" | "false"} |
byte | byte=value |
char | char=value |
double | double=value |
float | float=value |
int | int=value |
long | long=value |
short | short=value |
string | string=value |
Example
Suppose at run time your application code needs to determine whether to display a splash screen. To set the default for all devices to display the splash screen, you can add a parameter named “DISPLAY_SPLASH_SCREEN” to the _defaults_.xml file and set its value to “true”:
<param name="DISPLAY_SPLASH_SCREEN" bool="true"/>
The following shows the resulting parameter declaration in Parameters.java:
public static final boolean PARAM_DISPLAY_SPLASH_SCREEN = true;
Then for devices for which you do not want to display the splash screen, you can add the parameter to the target device file for those devices and the parameter value to “false”:
<param name="DISPLAY_SPLASH_SCREEN" bool="false"/>
If you build your project for one of the devices for which the splash screen should not be displayed, Mobile Designer reads the target device file, and as a result, uses the following parameter declaration in Parameters.java:
public static final boolean PARAM_DISPLAY_SPLASH_SCREEN = false;