Hi everyone, during development I needed to use string resources. I can fetch them from strings.xml for the layout xml file and for the MainActivity.java file (using getString(R.string.name)). But I can't get to use them in an external class file (which is being used to handle all the functions of the MainActivity file).
I have gone through StackOverflow forum and tried many answers but in vain. I tried using:
I have a orderProcessing button in mainActivity.java which gets processed in orderSummary function in mathCalculator.java. Everything works out fine when I use hardcoded strings. I just can't get to use the string resources from strings.xml to reference them.
The library you use from inside the activity is not dependent on the activities nor on the resource definitions. The only way to share a string between the activity and an external library is to provide the string as a parameter in a method call.