如何显示对话框中onCreate方法?方法、对话框中、onCreate

2023-09-12 01:22:25 作者:璃鱼浅戈亡魂溺海止于终老

如何显示对话框中onCreate方法?那是有可能的话,我试过,但我得到了泄露的窗口例外。任何人都可以建议我什么?

How to show Dialog in onCreate method ? Is that possible at all, I tried but I got leaked window exception. Can anyone suggest me anything ?

推荐答案

您可以使用ProgressDialog类与处理程序类的帮助。这样就可以达到你想要做什么。

you can use ProgressDialog Class with the Help of Handler Class. This way you can achieve what you want to do.

progDailog = ProgressDialog.show(loginAct,"Process ", "please wait....",true,true);

new Thread ( new Runnable()
{
     public void run()
     {
      // your loading code goes here
     }
}).start();


     Handler progressHandler = new Handler() 
     {

         public void handleMessage(Message msg1) 
         {

             progDailog.dismiss();
             }
     }