Aug 16, 2015 Replies: 40 Using the hooks feature it is possible to change the Activity theme at runtime. The theme is set before the activity is actually shown. This means that in order to change the theme we need to destroy the activity and start it again. You can use StateManager to save the activity state. The hook code is: Code: Copy #if java public void _onCreate() { if (_theme_value != 0) setTheme(_theme_value); } #end if There must be a process global int variable named Theme_Value. Note that the underscore is important. It prevents the obfuscator from changing the variable name which will cause the inline Java code to break. Updates Example updated and the selected theme value is stored in a file. The theme is set when the app starts. Attachments ThemeChange.zip ThemeChange.zip 8.5 KB · Views: 2,148 Last edited: Jan 25, 2019 Click to expand...
Using the hooks feature it is possible to change the Activity theme at runtime. The theme is set before the activity is actually shown. This means that in order to change the theme we need to destroy the activity and start it again. You can use StateManager to save the activity state. The hook code is: Code: Copy #if java public void _onCreate() { if (_theme_value != 0) setTheme(_theme_value); } #end if There must be a process global int variable named Theme_Value. Note that the underscore is important. It prevents the obfuscator from changing the variable name which will cause the inline Java code to break. Updates Example updated and the selected theme value is stored in a file. The theme is set when the app starts.
S silpot Member Licensed User Longtime User Jan 25, 2019 #41 Thanks Erel ! The new example is much better now !