Jaison Brooks Jaison Brooks - 1 month ago 6
Java Question

A boolean value defined in XML. How to reference in Java?

I'm trying to write some code that will reference a bool.xml file and will reference the current value inside the bool.

<bool name="enableQAurl">true</bool>


With this i want to be able to reference this in code, so that if its set to True it does something and if false does something else. Just a simple If and else statement.

Any code references or feedback is greatly appreciated.

Answer
 Resources res = getResources();
 boolean enableQAurl = res.getBoolean(R.bool.enableQAurl);

Source:
http://developer.android.com/guide/topics/resources/more-resources.html

Comments