I wish to display a toast
if a certain condition is true
or false
. However I want this toast to delay
for two seconds
before it is displayed.
How can I do this?
Current if statement:
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();
}
}