The problem is that when I switch from dark mode to light mode (android dark mode and android light mode), the activity which was going on that works fine but a duplicate activity starts all over again.
Now this does not matter when you are just working with visuals because the new activity covers the screen and old activity is not displayed but I am also working with sounds so the sounds playing in both the activities are heard.
In short, when switching from dark mode to light (or vice versa), the ongoing activity continues while a duplicate activity of the very same one starts from the beginning. I don't want this new duplicate activity. How do I avoid it?
I don't think my code is required here. I require the answer in Java.