Ive had a look at this question but as of the time i typed this question, there aren't any answers with Kotlin code.
in my colours.xml file how would i access colours like these for example using a string?
<resources> <!-- Orange --> <color name="orangePrimary">#f6a02d</color> <color name="orange1">#e3952a</color> <color name="orange2">#da8f28</color> <color name="orange3">#d08926</color> </resources> The Java version is apparently this
int desiredColour = getResources().getColor(getResources().getIdentifier("my_color", "color", getPackageName())); when android studio translates the code i get this
val desiredColour: Int = getResources().getColor( getResources().getIdentifier( "my_color", "color", getPackageName() ) However packageName() and getResources() turn out red for some reason which means there is an error
So what would the Kotlin version be?