Android resources in Kanzi¶
This example shows how to use Android resources in a Kanzi Studio project.
You can find the example in the <KanziWorkspace>/Examples/Android/Resource_import
directory.
Structure of the example¶
These modules make the application:
app
module is the main application. It provides the Android resources in this example and registers theresourceplugin
Java plugin. SeeMainActivity.java
.resourceplugin
module is a Java plugin. It provides a customResourceManager
protocol implementation to Kanzi Engine on Android device and for the Kanzi Studio Preview. SeeAndroidProtocolHandler.java
andPreviewAndroidProtocolHandler.java
.rro
module is an example of a runtime resource overlay (RRO). It showcases an overlay of the Android resources in this project. See<KanziWorkspace>/Examples/Android/Resource_import/Application/configs/platforms/android_gradle/rro/README.md
and the Android RRO documentation.
These nodes in the Kanzi Studio project use the Android resources that are defined in the application:
RootPage node has the Background Brush property set to the Resource ID with the value
android://color/background
.rotary node has the Image property set to the Resource ID with the value
android://drawable/rotary
.hello node has the Text property set to the Resource ID with the value
android://string/hello
.kanzi node has the Text property set to the Resource ID with the value
android://string/kanzi
.hello and kanzi nodes have the Foreground Brush property set to the Resource ID with the value
android://color/text
.
Running the example¶
To run the example:
Connect your Android device to your computer.
In the Kanzi Studio main menu select File > Export > Build Android Package.
Kanzi Studio creates an Android package from your Kanzi Studio project, deploys, and runs it on your Android device.