This PR addresses an issue where the counter.intValue was being reset to 0 every time the system theme was changed from light to dark or vice versa.
To fix this issue, we have used the savedInstanceState bundle to persist the value of counter across configuration changes like a theme switch. This bundle is used to save and restore the transient state of an activity when it may be killed and later recreated.
This PR addresses an issue where the
counter.intValue
was being reset to0
every time the system theme was changed from light to dark or vice versa.To fix this issue, we have used the
savedInstanceState
bundle to persist the value ofcounter
across configuration changes like a theme switch. This bundle is used to save and restore the transient state of an activity when it may be killed and later recreated.Files changed:
app/src/main/java/com/keshav/capturesposed/MainActivity.kt