Pregunta

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.

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top