This section explains what a resource is and how to add one.
What is a resource?
Actually this is an Android app terminology to define all the assets of an app besides the code itself. e.g. images, music files etc.
In addition to that, you can define resources for global values which you plan to use in multiple places in your entire project. For example, if you want an OK button's color be blue over the entire app, you can define a color resource and whenever you place an OK button on a screen, you set its color to this resource, not directly to blue. So in the future, if you change your mind and want to change the OK button's color to green, you just change the value of the resource and all the OK buttons in your app will be green without touching any of those buttons.
How to add an image?
In the main screen of DevPal Studio, there are
Images tab and
Other Resources tab. Although an image is also a resource, we've implemented a separate screen for images because it's the most used resource type and we think it deserves a screen for itself :)
Switch to the
Images tab on the main screen and click
Import new image button.
Alternatively, you can drag and drop an image file to the empty area on this Images tab.
When you import an image file, DevPal Studio will ask you about the density of the imported image. If you have a single image, you can check the
Auto generate images for other densities option and let the DevPal Studio generate the appropriate sized images for you.
For more information about Android app image resources, please refer this Android document.
How to add other resources?
For all the other resources except images, you can use
Other Resources tab in the main screen of DevPal Studio.
Alpha version limitation
Not all the resource types in the list are functional in alpha version. You can test out String, Integer, Color, Boolean and Raw files resource types.
For example, to add a new String resource, select the
Strings (Texts) from the resource types list and click
New Resource button. Give your resource a unique name and write a value for this string resource. It's that simple!
DevPal Studio has a feature to translate the text resources to other languages automatically (powered by Microsoft Translator API). This feature might not work as expected in alpha version!
How to use a res in NoCode?
All the data pins with appropriate data types can be assigned to a resource. To assign a resource to a pin, just click the small rectangle next to the pin's title or pin's value box and select
Select from resource.
A list of resources available for the data type of the pin will be displayed. So, if the pin's data type is a
string resources will be displayed.
When you assign a resource to a pin, resource name will be visible instead of pin value box.
Image resources in NoCode
Accessing image resources in NoCode is no different than accessing other resources. So the info above applies to the images too.