if(Math.random()*2>1){
// mock that the account is valid
}
else{
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("登录错误");
builder.setMessage("请重新登录");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(MainActivity.this, LoginActivity.class);
startActivity(intent);
}
});
AlertDialog dialog = builder.create();
dialog.show();
}