首先自己创建一个方法
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("您的账号被其他人登录").setMessage("需要对您强制下线,请确认您的账号安全")
.setPositiveButton("修改密码", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent=new Intent(PollingService.this, ChangepasswordActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}).setNegativeButton("重新登录", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Intent intent=new Intent(PollingService.this, LoginActivity.class);