I am experiencing a weird behavior in my app.
I have an Activity with a ListView. When you click on an item in the ListView, a TimePickerDialog is shown.
If I hit the home button after closing the dialog, and then reload the app, the TimePickerDialog is shown automatically again.
Now, I don’t know why this behavior happens. I have logged messages at different points in the app to try to determine how it is triggered but to no avail.
I even added this line:
Log.d("TEST", "TEST");
inside the constructor of the TimePickerFragment and it is not getting fired! Yet the dialog is showing up!
What is going on here?
Thanks to nandeesh’s answer, I was able to figure out how to fix that behavior.
Since my dialog was managed, I had to call the dismissAllowingStateLoss() method on my dialog instance.
Works like a charm now.