android - Issue with AsyncTask -


in android app, there surfaceview. whenever user touches short( 1 sec) animation rendered on surfaceview asynctask. face force close problem in 2 scenarios.

  1. when used presses key while animation running.
  2. in arcade mode game duration of 60 seconds. @ end of game, new activity started. if @ end of game , animation still running while new activity started, force close error message.

how can check if asynctask complete i.e. animation over, before key press takes effect or new activity started ? using asynctask.getstatus() in while loop freezing app. or there alternative way this?

one of way wait finish asynctask.execute().get() ;

with main thread wait finish


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -