Use Runnables to show and hide the dialog.