参考地址:http://blog.csdn.net/woaieillen/article/details/7378324
1.弹出提示框
new AlertDialog.Builder(LoginActivity.this) //LoginActivity为类名
.setTitle("提示")
.setMessage("该用户名不存在或密码错误!")
.setPositiveButton("确定", null)
.show();
2.弹出对话框
new AlertDialog.Builder(RegSuccess.this)
.setTitle("提示")
.setMessage("确定退出?")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
setResult(RESULT_OK);//确定按钮事件
finish();
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
//取消按钮事件
}
})
.show();