I know that you need to restart the activity to apply a new theme, so maybe the way this is done is with a different approach.
This is what I will like to accomplish, as you can see the app it's not restarted and there's a transition between the ligth and dark theme.