2

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.

Bart Friederichs
  • 33,050
  • 15
  • 95
  • 195

1 Answers1

0

You don't need to call dismiss, just try out by calling finish see, since finish will close any dialog

Community
  • 1
  • 1
forcewill
  • 1,637
  • 2
  • 16
  • 31
  • Yes, it closes it, but it seems to rotate back to portrait. Also, the screen is black for a short time. When I use the `Handler` , it closes cleanly. – Bart Friederichs Aug 31 '15 at 13:02