How to get the color code from and xml file so that it could be used in the MainActivity?



So let's say in my colors.xml file I have this:



<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name = "cyan100">#B2EBF2</color>
<color name = "cyan200">#80DEEA</color>
<color name = "cyan400">#26C6DA</color>
</resources>


In my MainActivity.java I have this:



String js = "<html><head>"
+ "<link rel='stylesheet' href='file:///android_asset/mathscribe/jqmath-0.4.0.css'>"
+ "<script src = 'file:///android_asset/mathscribe/jquery-1.4.3.min.js'></script>"
+ "<script src = 'file:///android_asset/mathscribe/jqmath-etc-0.4.2.min.js'></script>"
+ "</head><body bgcolor = "+ **<GET CYAN100 COLOR CODE>** +"><font color = \"white\">"
+ "<script>var s = '$$x={-b±√{b^2-4ac}}/{2a}$$';M.parseMath(s);document.write(s);</script> </font></body>";
layout_start.loadDataWithBaseURL("", js, "text/html", "UTF-8", "");


How do I get the cyan100 color code for from the xml file?


No comments:

Post a Comment