2
Hello! I have a java code where I would like to change the Androidmanifest themes according to the return of a certain function.
Example: Having a boolean function that checks the internet connection, the activity will use one theme when the function is true and another when the function is false.
<style name="TemaVerdadeiro" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="TemaFalso" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/branco</item>
<item name="colorPrimaryDark">@color/branco</item>
<item name="colorAccent">@color/ERRO</item>
</style>
Is there a command that can choose these themes according to the chosen condition?
Thank you very much, it will be very useful. Would you have any way to do this after setContentView()? (I mean, while running the activity)
– julio.c