Getting 'Cannot resolve method 'addOnCompletionListener()'…' while trying to place some code inside builder.setPositiveButton's onClick() method

后端 未结 2 1559
轮回少年
轮回少年 2020-12-20 13:22

I\'m trying to place some code inside AlertDialog.Builder\'s builder.setPositiveButton method.

The problem is that I\'m getting the follow

相关标签:
2条回答
  • 2020-12-20 14:08

    Your issue happen with this line code:

    .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
    

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

    The solutin is so simple:

    .addOnCompleteListener(ActivityName.this, new OnCompleteListener<AuthResult>() {
    

    Insted of this use ActivityName.this.

    0 讨论(0)
  • 2020-12-20 14:15
    addOnCompleteListener(this, new OnCompleteListener<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, new OnCompleteListener<AuthResult>()
    
    0 讨论(0)
提交回复
热议问题