【发布时间】:2015-08-01 06:47:47
【问题描述】:
我一直在尝试编译这个简单的警报对话框,以便在用户单击提交按钮时显示。编译代码时弹出错误信息:
错误:(33, 74) 错误:不兼容的类型:
无法转换为 Context
这个类叫Login_Activity,继承BaseActivity,继承Activity。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
mUserNameEt = (EditText) findViewById(R.id.login_username_et);
mPasswordEt = (EditText) findViewById(R.id.login_password_et);
mSubmitBtn = (Button) findViewById(R.id.login_submit_btn);
mSubmitBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder messageBox = new AlertDialog.Builder(this);
messageBox.setTitle("Atlas Box");
messageBox.setMessage("Dictionary.");
}
});
}
【问题讨论】:
标签: java android android-sdk-tools