I've seen this done before in Android so I know it's possible. I want to add a preference that changes the app theme using a listPreference. I've been fiddling around with some XML code but I'm stuck on the Java part.
Here is the listPreference in my settings.xml file:
<ListPreference
android:entries="@array/Theme"
android:entryValues="@array/themeAlias"
android:key="theme_chooser"
android:title="Theme"
android:summary="Change the theme of the main activity." />
And here is my string arrays in my array.xml file:
<string-array name="Theme">
<item>Default Theme</item>
<item>Holo Light</item>
</string-array>
<string-array name="themeAlias">
<item>"default"</item>
<item>"light"</item>
</string-array>
Now here is some psuedocode that I don't know how to write into actual code:
Find the listPreference
if preference is equal to default
set the main activity's theme to custom a theme
else
set the theme to a standard light theme
I have done about 20 Google searches for this and all I get is a bunch of theming apps and blog posts about how to theme your android phone like a boss...I want to have users theme my app like a boss!
Thanks in advance,
Andrew