我有以下的code:
new AlertDialog.Builder(this)
.setTitle("WOW!")
.setMessage("AnotherMessage")
.setNegativeButton("Okay", null)
.setPositiveButton("SHARE!", new DialogInterface.OnMultiChoiceClickListener() {
public abstract void onClick (DialogInterface dialog, int which){
//Code to share
}
}).show();
我要两个都在我的警告对话框一个分享按钮与一个onclick听众,我会把在code分享。问题是,我收到错误:
I want two have a share button in my alert dialog with an onclick listener where I will put in the code to share. The problem is, I am getting the errors:
以下是错误:
我已经尝试了很多不同的东西,比如改变我的方法的参数,并把摘要
中的匿名内部类,但没有工作的话。
I have tried many different things, like changing my method parameters and putting the word abstract
in the anonymous inner class, but nothing worked.
我该如何解决这个问题?
How can I fix this?
您应该使用 DialogInterface.OnClickListener
接口而不是 DialogInterface.OnMultiChoiceClickListener 。
You should use DialogInterface.OnClickListener
interface instead of DialogInterface.OnMultiChoiceClickListener
.