I am building a HarmonyOS application and want to load color values that I have placed in the resources folder in resources/base/element/color.json. How can I load this color in my Java class?
In Android we can use the getColor() function for this:
context.getResources().getColor(R.color.colorID);
What is the alternative for this in HarmonyOS?
Create the query with harmonyos tag in stackoverflow and share the link here:
Developer Platform: Windows
DevEco Studio version: 2.1.0.303
SDK API version: 5
SDK version: 2.1.1.21
Device: Not Required
Device OS version: Not Required
Describe the query
I am building a HarmonyOS application and want to load color values that I have placed in the resources folder in
resources/base/element/color.json
. How can I load this color in my Java class?In Android we can use the
getColor()
function for this:What is the alternative for this in HarmonyOS?
Create the query with harmonyos tag in stackoverflow and share the link here:
https://stackoverflow.com/questions/68542335/how-to-load-color-resource-using-resource-id-in-harmonyos
Additional information
Developer Platform: Windows DevEco Studio version: 2.1.0.303 SDK API version: 5 SDK version: 2.1.1.21 Device: Not Required Device OS version: Not Required