Chris Chris - 4 months ago 12
Android Question

How to programatically set Android application theme for all activities

I have already googled setting application themes quite a bit and what I found was to either use the

AndroidManifest.xml
or to set it use
setTheme
before
setContentView
is called. I am going to allow users to switch between 2 themes I have created in the settings so I have to go the
setTheme
route. I have already figured out how to set it but I am wondering how I would set the user selected theme to ALL activities. Currently it only applies to the main activity.

flx flx
Answer

IMHO the best approach is creating a BaseActivity extending Activity to do the setTheme() in onCreate() based on the settings.
Then let every Activity extend BaseActivity.

Comments