Sunday, 15 April 2012

android - How to check if an activity is active? -


I am using an AlertDialog in an activity. But when I close the activity before displaying the dialog, the app crashes, because the reference dialeg is not present. Therefore, I only want to display the dialog when the activity is active. So my question is whether activity is active or not. thank you in advanced.

Check the flag before displaying the dialog.

  if (! Hyphenishing ()) {// show dialog} 

No comments:

Post a Comment