Resources should be always externalized from your application code.
Externalizing resources allows developers to provide alternative resources that support specific devices such as different languages or screen sizes. In order to provide compatibility with different platforms and configurations, you must organize resources in your project’s res/ directory, using various sub-directories that group resources by type and configuration. This ‘res’ folder should always exist, else an error will be displayed.
Resource folder organization
MyProject/ src/ com/ company/ application/ MyApplication.java MyScreen.java assets/ res/ icon/ icon-48.png image/ graphic.png layout/ main_layout.xml string/ strings-en.xml values/ colors.xml dimens.xml fonts.xml ids.xml
For any type of resource, you can specify default and multiple alternative resources for your application:
Default resourcesare those that should be used regardless of the device or when there are no alternative resources that match the current device.
Alternative resourcesare those that should be used with a specific device. To specify that a group of resources is for a specific device, append an appropriate configuration qualifier to the directory name.
NeoMAD also creates a
Res.java file containing constants to identify the application’s resources.
In the source code, the resources will be accessed through methods from the
(such as ResManager.getString(), ResManager.getImage(), etc.) or constructors of UI element classes
(such as TextArea(int resId), ImageLabel(int resId), etc.). All these methods take their resource
id parameter from
The Res class is automatically generated by NeoMAD at compilation time. This means that the constants used to access resources will only be declared in the project source code once it has been compiled.