This was something that I expect not to be happening as per my understanding.
In my app, I execute() an AsyncTask which might take less than 2-3 seconds. In that AsyncTask I have runOnUiThread() which updates few UI controls value.
This works fine until, if I do a click on Sign out button which does a finish() of Activity.
I get Null pointer exception that findViewById returned null. I can add null check before updating but considering the amount of UI screens and AsyncTasks used I would end up in huge number of checks.
Why would the UI thread still be in execution after finish() is called?
What is best solution to this case? Issue happens only when there is exact coincidence with time difference between AsyncTask completion and call to finish().
Regards,
Harsha