监听器重名

项目中遇到。button需要OnClickListener 监听器。AlertDialog 中的button 也需要OnClickListener 监听器。


import android.view.View.OnClickListener;

import  android.content.DialogInterface.OnClickListener()

不能同时import同一个监听器,只import一个监听器另一个报错。


解决方法:

import一个

另一个在使用时直接指定接口位置:

builder.setNegativeButton(update,  new android.content.DialogInterface.OnClickListener()


注:

eclipse 简单的自动提示错误修改方法:ctrl + 1

eclipse 自动import缺的包 shift + ctrl + o

 

posted @ 2014-05-16 15:21  也行  阅读(101)  评论(0编辑  收藏  举报