Expectation of AsyncTask without blocking the main UI flow



  • We need to wait for AsyncTask to complete without locking the main flow to make it impossible to get out of Activity by firing Back.

    How do we do that?



  • Get yourself a flag like this. boolean♪ that keeps quiet ♪ falseonPostExecute() AsyncTask Put it in the true, and redesign it. onBackPressed Ooh. ActivitySo long as the flag != trueDon't do anything.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2