If I use ProgressDialog.show()
on main which does call 2 AsyncTask. AsyncTask A and AsyncTask B may finish in undetermined order so I put ProgressDialog.dismiss()
in onPostExecute in both AsyncTask.
The question is should I check for null value in both AsyncTask before dismissing the dialog?
if(progressDialog != null && progressDialog.isShowing()){ progressDialog.dismiss(); }
OR just:
progressDialog.dismiss();
I don't know if ProgressDialog.dismiss() will handle this for me or it will throw NullPointerException if I don't check for null value before dismissing.
java says this is always good to check for null . but you must
progressDialog.isShowing()
otherwise you can get a leak window exception sometime.