2010-10-28 91 views
0
mycontext.startActivity(new Intent(mycontext, logoSplash.class)); //this finishes after 3 seconds: 

    initcontrols(); 

    final Timer timerStartAll = new Timer(); 
    timerStartAll.schedule(new TimerTask() { 
    @Override public void run() { 
    handler.post(new Runnable() { public void run() { 
    timerStartAll.cancel(); 
    start(); 
    }}); 
    } 
}, 4000, 5000); 

功能开始:的Android无法显示processdialog

utils.showLoaderDialog( “刷新!”, “刷新”。);

在utils的类:

public static ProgressDialog dialog; 
public static void showLoaderDialog(String sHead, String sMess) { 
dialog =ProgressDialog.show(myActivityStart.mycontext, sHead, sMess, true, true); 
} 
public static void hideLoaderDialog() { 
dialog.dismiss(); 
} 

为什么我无法查看进程对话框?

回答

1

写在onCreate方法

ProgressDialog pd = ProgressDialog.show(this, "", "Please Wait...", true, false); 
    Thread th = new Thread(videoList); 
    th.start(); 

然后添加这个功能

public Runnable videoList = new Runnable() { 

     public void run() { 
        //your code 
       handler.sendEmptyMessage(0); 
     } 
    }; 

    private Handler handler = new Handler() { 

     @Override 
     public void handleMessage(Message msg) { 

      if (pd != null) 
      pd.dismiss(); 
     } 
    }; 
+0

工作感谢ü非常 – lacas 2010-10-29 07:21:48