1

I made an android app that shows an internal html with javascript in a webview. The javascript has an infinite loop to update the view once each minute.

The problem is that after I close my app with the back button, the javascript continues its infinite loop... Why is this happening and how can I prevent this?

Thanks! L.

Luis A. Florit
  • 2,169
  • 1
  • 33
  • 58

1 Answers1

3

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().

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491