我将如何强制当前线程等到另一个线程完成后再继续。
在我的程序中,用户MODE
从一个中选择一个AlertDialog
,我想在继续之前停止程序的执行,因为该模式对游戏玩法具有重要的配置。
new AlertDialog.Builder(this)
.setItems(R.array.game_modes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case 0:
setMode(TRAINING_MODE);
case 1:
setMode(QUIZ_MODE);
default:
setMode(TRAINING_MODE);
break;
}
//continue loading the rest of onCreate();
contineOnCreate();
}
})
.create().show();
如果这是不可能的,谁能给出一个可能的解决方案?