sop_控件_alertdialog

1
2
3
4
5
6
7
8
9
10
11
12
13
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle("Warning");
builder.setMessage("You are forced to be offline. Please try to login again.");
builder.setCancelable(false);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {

public void (DialogInterface dialog, int which) {
ActivityCollector.finishAll(); // 销毁所有的活动
Intent intent = new Intent(context , LoginActivity.class);
context.startActivity(intent); // 重新启动 LoginActivity
}
});
builder.show();