当前位置: 代码迷 >> Android >> ProgressDialog闪一下就消失了
  详细解决方案

ProgressDialog闪一下就消失了

热度:54   发布时间:2016-05-01 10:43:50.0
求助:ProgressDialog闪一下就消失了?
为什么:ProgressDialog闪一下就消失了?谢谢!

private void progressDialg(){
   dialog = ProgressDialog.show(getActivity(), "加载中...", "正在启动QQ...请等待!!",true,true);  

   Thread thread = new Thread(new Runnable() {  
   public void run() {      
   Message message = new Message();  
   message.what = 0;  
   mHandler.sendMessage(message);  
   }  
  });  
     thread.start(); 
}

//等待界面
private Handler mHandler =new Handler(){
 public void handleMessage(Message msg)     


 if (msg.what == 0) { 
 
Intent intent = new Intent(this, test.class); 
startActivity(intent);

dialog.cancel();
 }  
}

};
ProgressDialog

------解决方案--------------------
引用:
为什么:ProgressDialog闪一下就消失了?谢谢!

private void progressDialg(){
   dialog = ProgressDialog.show(getActivity(), "加载中...", "正在启动QQ...请等待!!",true,true);  

   Thread thread = new Thread(new Runnable() ……


http://blog.csdn.net/zhangxu365/article/details/7942654
建议参考下
------解决方案--------------------
设置一个标记位,当你愿意让dialog 消失的时候 你才让Thread 发送消息