正如我所看到的,Android 不会等待在 setContentView(...) 之类的句子之前执行所有句子。
例如,我不能这样做:
Calendar c = Calendar.getInstance();
int seg = c.get(Calendar.SECOND);
int min = c.get(Calendar.MINUTE);
int sum = 1;
for (int i = seg; i < 5 + seg; i++){
for(int j = min; j < 10000+ min; j++){
seg = c.get(Calendar.SECOND);
sum += seg;
}
Toast.makeText(getApplicationContext(), Integer.toString(sum), Toast.LENGTH_SHORT).show();
}
setContentView(R.layout.results);
Android 在计算完成之前执行 setContentView。我怎么能做到之前的Android等待语句?