Class cannot be cast to android.view.View$OnClickListener

后端 未结 1 1816
眼角桃花
眼角桃花 2021-01-28 08:10

I\'ve some problems trying to do G+ Signin. I think the G+ button isn\'t working.

I\'ve tried to clean the project too.

IDE: Android Studio 1.1.0 Play Services:

相关标签:
1条回答
  • 2021-01-28 08:13

    If you read the Logcat you can see that you have a problem here :

    com.nimbus.podchest.LoginActivity.onCreate(LoginActivity.java:25)
    

    So at line 25 in onCreate function you are trying to cast your activity (LoginActivity) to android.view.View$OnClickListener. You can't cast this class like this since there are not related.

    You need to add implements OnClickListener on the definition of your LoginActivity class to make your cast work.

    And now you will be able to just pass your current Activity to register to the listener:

    SignInButton.setOnClickListener(this);
    
    0 讨论(0)
提交回复
热议问题