首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

ProgressDialog闪一下就消失了

2013-05-02 
求助:ProgressDialog闪一下就消失了?为什么:ProgressDialog闪一下就消失了?谢谢!private void progressDia

求助: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 发送消息

热点排行