我正在线程在MainActivity中完成其任务之后尝试运行一行代码,但即使在线程完成其任务之前,该行也会运行。
new PostUsernameAndPassword(username,password, UserAuthenticationFailAlert);
//this line is running before the value is set in the thread!!
if(UserAuthenticationFailAlert.getText().toString().equals("Access granted")){
//do something
}
我该如何在android中执行function.then()?