Building Mobile Enterprise Applications : webMethods Mobile Development Help : Creating and Building a Mobile Application : Defining Resources for the Mobile Project : Storing Image Files for the UniversalResHandler
Storing Image Files for the UniversalResHandler
When using the UniversalResHandler resource handler, you need to store image files in a specific folder structure. The required folder structure is automatically created for a project when you create the project using the Mobile Development New Mobile Development Project wizard, as described in Creating a New Mobile Project.
The structure allows you to supply different image files for different platforms. For example, if a mobile application uses an image file named myimage.png, you might need one version of the image file for an Android device and a different version for an iOS device. The folder structure allows you to save both, and at run time the application selects the correct image file based on the device on which the mobile application is running.
The folder structure has platform-specific folders and a single general-purpose folder. Use the general-purpose folder to save image files that can be used for devices running on any platform. The following shows an example for a project named "MyProject":
MyProject
resources
graphics
Android
general
iOS
WinPhone
icons
text
www
Additionally, each of the main image folders (Android, iOS, WinPhone, and general) contain subfolders themselves. This allows you to supply different image files for different devices within a platform. For example, if a mobile application uses an image file named myimage.png, you might need one version of the image file for an iOS non-retina device and a different version for an iOS retina device. The following table describes the subfolder structure for each main image folder:
Main image folder
Description of its subfolder structure
Android
The subfolders are based on screen density of Android device on which the mobile application runs. The following shows the subfolder structure:
Android
drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xhdpi
drawable-xxhdpi
iOS
The subfolders are based on the display property of the iOS device, either non-retina or retina. The following shows the subfolder structure:
iOS
NonRetina
Retina
RetinaHD
WinPhone
The subfolders are based on the screen resolution of the Windows Phone device and whether background color of the view in which the image is displayed is dark or light. The following shows the subfolder structure:
WinPhone
Dark
1080p
720p
WVGA
WXGA
Light
1080p
720p
WVGA
WXGA
general
The subfolders are based on the width (in pixels) of the container in which the image is displayed at run time. For example, the container might a view or table cell. The following shows the subfolder structure:
general
w200
w400
w600
w800
At run time, the application searches the folders in the following order to locate the version of the image to use:
1. Platform-specific subfolder. For example, if the application is running on an iOS retina device, the application first attempts to locate the image in the resources/graphics/iOS/Retina/ folder.
2. Platform-specific root folder. Continuing with the example, if the image was not found in the platform-specific subfolder, the application next looks for the image in the platform-specific root folder, which is resources/graphics/iOS/ folder.
3. General subfolder. Continuing with the example, if the image was not found in the platform-specific root folder, the application next looks for the image in the appropriate general subfolder. For example, if the image is to be displayed in a table cell that is 150 pixels, the application looks for the image file in the resources/graphics/general/w200/ folder.
4. General folder. Continuing with the example, if the image was not found in the general subfolder, the application next looks for the image in the general root folder, which is resources/graphics/general/ folder.
After searching for the image file, if the application does not locate an image file to use, it returns a placeholder image file. The placeholder image file is a point with size 1x1 pixel.
Copyright © 2007-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback