Why is this happening
Because you did not stop the loop. It will keep going until Android terminates the process.
how can I prevent this?
Stop the loop. You really should be stopping it in onPause()
or onStop()
, picking it up again (if needed) in onResume()
or onStart()
.