Mobile Development 10.11 | webMethods Mobile SuiteWeb Help | Using webMethods Mobile Designer | Creating Mobile Application Projects | Setting Properties and Parameters for a Mobile Application Project | Using Parameters in Your Application Code
 
Using Parameters in Your Application Code
When creating an application, typically you have common logic that works for all target devices. However, you might require branches in the logic to address the needs of a specific target device. For example, you might need to omit or alter a feature for a target device, or you might need to position an image relative to the screen dimensions for a target device. To accommodate device-specific logic, your application logic can branch based on parameter values that are set using the device profile settings.
To use parameters in your application code, import the com.software.mobile.runtime.Parameters class. You can then easily access parameter values. For example, if you want to branch logic based on an application-specific “PARAM_DISPLAY_LAUNCH_SCREEN” parameter, you can use a statement like the following:
if (Parameters.PARAM_DISPLAY_LAUNCH_SCREEN)
You also use parameters that define identifiers for resources and resource blocks to load resources and resource blocks into memory, and unload them from memory, as necessary.
ResourceHandler.instance.loadResourceBlock (Parameters.RESBLOCKID_LAUNCHES);
 
launch_screen_image_id = ImageHandler.instance.loadImageID
(Parameters.RESID_LAUNCH_SCREEN_IMAGE, -1, -1, false);
 
ResourceHandler.instance.unloadResourceBlock (Parameters.RESBLOCKID_LAUNCHES);
For more examples about how to use the parameters in application code, review the code provided with the NativeUI Demo New sample application.