Skip to content Skip to sidebar Skip to footer

Getting 'cannot Resolve Method 'addoncompletionlistener()'.......' While Trying To Place Some Code Inside Builder.setpositivebutton's Onclick() Method

I'm trying to place some code inside AlertDialog.Builder's builder.setPositiveButton method. The problem is that I'm getting the following error: Cannot resolve method 'addOnCompl

Solution 1:

addOnCompleteListener(this, newOnCompleteListener<AuthResult>()

"this" in this line means your DialogInterface.OnClickListener , you should check what kind of params this method needs, if Context, try to change it to this

addOnCompleteListener(YourActivityName.this, newOnCompleteListener<AuthResult>()

Solution 2:

Your issue happen with this line code:

.addOnCompleteListener(this, newOnCompleteListener<AuthResult>() {

Here this parameter compiler let as .OnClickListener insted of your activity context.

enter image description here

The solutin is so simple:

.addOnCompleteListener(ActivityName.this, newOnCompleteListener<AuthResult>() {

Insted of this use ActivityName.this.

Post a Comment for "Getting 'cannot Resolve Method 'addoncompletionlistener()'.......' While Trying To Place Some Code Inside Builder.setpositivebutton's Onclick() Method"