标签:tab amp dialog ext button ttext listener ring title
1、创建弹框的公共类
import android.app.AlertDialog;
import android.content.Context;
public class DialogBase {
public static void showmessage(Context context, String message,String FirstBtn)
{
AlertDialog.Builder ab = new AlertDialog.Builder(context);
ab.setTitle("消息标题");
ab.setMessage(message);
ab.setPositiveButton(FirstBtn, null);
ab.show();
}
}
2、调用DialogBase 方法
btnlogin.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (etname.getText().toString().isEmpty()) {
DialogBase.showmessage(LogInActivity.this, "请输入账号信息!", "确定");
return;
}
if (etpwd.getText().toString().isEmpty()) {
DialogBase.showmessage(LogInActivity.this, "请输入密码信息!", "确定");
return;
}
if (etname.getText().toString().equals("admin") && etpwd.getText().toString().equals("123")) {//判断是否选中记住密码
getckpwd();
Intent intent = new Intent(LogInActivity.this, TabBottom.class);
startActivity(intent);
} else {
DialogBase.showmessage(LogInActivity.this, "用户名或密码有误!", "确定");
}
}
});
标签:tab amp dialog ext button ttext listener ring title
原文地址:https://www.cnblogs.com/lzsin/p/10363453.html