android编译错误“OnClickListener cannot be resolved to a type”解决方案
2015-03-26 19:09
274 查看
在android代码编译时可能会出现如下错误:
部分代码:
[html] view
plaincopy
<span style="font-size:18px;">public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.addnew);
btn_img=(ImageButton) this.findViewById(R.id.btn_img);
btn_img.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
initImageChooseDialog();
imageChooseDialog.show();
}
});</span>
错误提示:OnClickListener cannot be resolved to a type
解决方案:将语句btn_img.setOnClickListener(new OnClickListener(){···}中的OnClickListener改为View.OnClickListener即可
部分代码:
[html] view
plaincopy
<span style="font-size:18px;">public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.addnew);
btn_img=(ImageButton) this.findViewById(R.id.btn_img);
btn_img.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
initImageChooseDialog();
imageChooseDialog.show();
}
});</span>
错误提示:OnClickListener cannot be resolved to a type
解决方案:将语句btn_img.setOnClickListener(new OnClickListener(){···}中的OnClickListener改为View.OnClickListener即可
相关文章推荐
- android编译错误“OnClickListener cannot be resolved to a type”解决方案
- android编译错误“OnClickListener cannot be resolved to a type”解决方案
- android编译错误“OnClickListener cannot be resolved to a type”
- android编译错误“OnClickListener cannot be resolved to a type”解
- Android:OnClickListener cannot be resolved to a type
- android: OnClickListener cannot be resolved to a type
- 【android】:OnClickListener cannot be resolved to a type
- Android:OnClickListener cannot be resolved to a type
- Error:OnClickListener cannot be resolved to a type
- OnClickListener cannot be resolved to a type
- 关于“OnClickListener cannot be resolved to a type”问题
- 【转】OnClickListener cannot be resolved to a type
- OnScrollListener cannot be resolved to a type 解决方案
- android--jni编译错误的解决方案:.c源文件出现类似Type 'jstring' could not be resolved
- 关于Android中“OnClickLinstener cannot be resolved to a type”的错误
- xxx cannot be resolved to a type 错误解决方法
- myeclipse:报String cannot be resolved to a type错误
- 刚刚开始学Android,EditText cannot be resolved to a type是什么原因
- adt "cannot be resolved to a type"错误解决办法
- Android开发中出现cannot be resolved to a variable错误,也就是R文件不能生成。