【发布时间】:2014-08-24 00:15:07
【问题描述】:
如果某个条件是true 或false,我希望显示toast。但是,在显示之前,我希望 delay 为 two seconds 祝酒。
我该怎么做?
当前 if 语句:
if (result.equals("true")) {
loginDataBaseAdapter.updateUploadedRecord(sessionId);
Toast.makeText(MathsGameResults.this,
"Data is successfully uploaded.",
Toast.LENGTH_LONG).show();
} else {
Toast.makeText(
MathsGameResults.this,
"Error while uploading. Please try again later.",
Toast.LENGTH_LONG).show();
}
}
【问题讨论】:
-
@james Thread.sleep() 冻结 UI。你必须使用处理程序