问题与对话?问题

2023-09-07 13:46:24 作者:关东煮小熊仔

我有以下的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.

 
精彩推荐
图片推荐