Cannot convert from View to Button

后端 未结 3 1004
一个人的身影
一个人的身影 2021-01-28 06:29

Very frustrating problem I have here. I have this code:

Button b = findViewById(android.R.id.button1);

And I\'m getting this error on it:

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-28 07:08

    Your mistake is here-Button b = findViewById(android.R.id.button1);

    Replace the above line by findViewById(R.id.button1);

提交回复
热议问题