-9
我想處理一些數據庫操作,然後想開始一個新的活動。同時,我想要顯示進度條。Android應用程序崩潰,從不同的線程開始下一個活動
下面我寫的代碼在android studio以及某些設備上工作正常,但在某些設備上,從線程開始新活動時,應用程序正在崩潰。請幫幫我。
在此先感謝。
progress=new ProgressDialog(this);
progress.setMessage("Prepairing relations...");
progress.setProgress(0);
progress.setCancelable(false);
progress.show();
final Thread t1 = new Thread() {
@Override
public void run() {
sql.updateRelations(); // db operations
Intent intent = new Intent(context, MainActivity.class);
progress.dismiss();
startActivity(intent);
finish();
}
};
t1.start();
哪裏是你的logcat? –