My application has a common main activity. The main activity reads its configuration from the arrays.xml file, for example follow
<?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="home_buttons_text"> <item>@string/Title_1</item> </string-array> <array name="home_buttons_icon"> <item>@drawable/google</item> </array> <string-array name="home_buttons_url"> <item>http://www.google.com</item> </string-array> <array name="themes"> <item>@style/my_theme</item> </array> </resources>
So, to add a new icon, I just posted new lines here.
So, in the "themes" I have a topic name. How can I download and apply a theme called a name?
For the icons that I used
TypedArray mItemsIcons = resources.obtainTypedArray(R.array.home_buttons_icon); TypedArray mThemes = resources.obtainTypedArray(R.array.themes); . . . mItemsIcons.getDrawable(position); . . .
But I have no idea how to get the topic. I tested
int theme = mThemes.getResourceId(position); setTheme(theme);
but that will not work.
More details here: http://developer.android.com/guide/topics/resources/more-resources.html#TypedArray
source share