0
我使用這個簡單的代碼的Android progressDialog dont't顯示,如果startActivity(myIntent)
public class Main extends Activity {
private ProgressDialog progressDialog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//bouton Exemples de prix
findViewById(R.id.button1).setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
//start the progress dialog
runDialog(4);
Intent myIntent = new Intent(getBaseContext(), Exemple_prix.class);
startActivity(myIntent);
}
}
);
}
private void runDialog(final int seconds)
{
progressDialog = ProgressDialog.show(this, "", "Chargement...");
new Thread(new Runnable(){
public void run(){
try {
Thread.sleep(seconds * 1000);
progressDialog.dismiss();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
的progressDialog
沒有顯示,但它的工作原理,如果我禁用
//startActivity(myIntent);
你是個例子嗎? – user1094324
最後,這個代碼與2.2模擬器問題工作正常和1.5 – user1094324