2010-10-28 53 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