I encountered this somewhat strange behavior while developing on Android and during my googling the only answer I could find was that this is by design and that I should not care about it.
My application fetches location data while active, and I was about to implement a way to preserve battery by stopping location updates when the onPause event is called, and later resume fetching when the onResume event is called.
While debugging I noticed this strange behavior when locking the phone, onPause->onResume get called one after another three or more times and then end with a onStop event. The only answer I where able to find was like: that's how android works, nevermind.
I guess I'm curious, can someone explain me the need to stop and resume a simple sub-activity several times? Doesn't that consume more battery, especially for larger activities that have serious code in onResume? Is there a way to prevent this from happening? I would be happy just by knowing that at least my code in those events doesn't get called, maybe with a if{} block preventing unnecessary CPU cycles.
Any insight is greatly appreciated!