I have an Activity
that creates and shows a Dialog
to show finishing progress. I want the Activity
to finish()
right after I dismiss
the Dialog
:
myDialog.dismiss();
finish();
But, when I do that, I see the screen rotate back (I force landscape, while the sensor says portrait). Also, the screen is black for some time.
When I postpone my finish()
call with a Handler
, I do not see that behaviour (it closes straight into the previous Activity
):
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
finish();
}
}, 5000);
What is going on here?
Update I call finish()
from a Runnable
that is invkoed from a Handler
. Perhaps that's part of the issue.