final ProgressDialog ps = ProgressDialog.show(MainActivity.this, "搜索网络", "请等待..."); new Thread(){ @Override public void run() { try { sleep(11000); } catch (Exception e) { // TODO: handle exception } finally{ ps.dismiss(); } } }.start(); ps.show();