I have multiple tabs with text on them. I have another tab which is responsible for holding the GUI elements to change the value of the default text size. I already have a default value set in the xml files. How might I go about doing this, creating a variable that is accessible to all activities?
Asked
Active
Viewed 61 times
0
-
You can access xml values using getResources(). check the resources class documentation on the respective API's. In your case, it might be getInteger(). – prijupaul Sep 09 '13 at 22:44
-
I usegetView().findViewById(R.dimen.text_size), but then how do I change that? – Faraz Masroor Sep 09 '13 at 22:49
-
You should be using getResources().getDimension(R.dimen.text_size) to get the value set. findViewById will only find the Views and not dimentions. – prijupaul Sep 09 '13 at 22:54
1 Answers
0
Question kind of vague but anyway here is my answer
<resources>
<integer-array name="UserBases">
<item>2</item>
<item>8</item>
<item>10</item>
<item>16</item>
</integer-array>
</resources>
Resources r = getResources();
int[] bases = r.getIntArray(R.array.UserBases)
Use the bases
array to pic your size
Here's the way to do it Communicating with Other Fragments

Erik
- 5,039
- 10
- 63
- 119
-
-
You have to let them all know what
- xxx
to use. You could create an interface that will tell everyone what to do. What we are talking about now is standard communication among Activities and fragment. Check this [answer](http://stackoverflow.com/questions/14247954/communicating-between-a-fragment-and-an-activity-best-practices) – Erik Sep 09 '13 at 22:52