The method setOnClickListener(new View.OnClickListener(){}) is undefined for the type imageButton1

后端 未结 1 993
旧巷少年郎
旧巷少年郎 2021-01-24 00:05

I keep getting this error message and I am not sure what I am supposed to do.

The method setOnClickListener(new View.OnClickListener(){}) is undefined for

相关标签:
1条回答
  • 2021-01-24 00:10

    Try:

    ImageButton imageButton1 = (ImageButton) findViewById(R.id.imageButton1);
    imageButton1.setOnClickListener ....
    

    ImageButton is the name of the class, imageButton1 the name of your instance of the class.

    0 讨论(0)
提交回复
热议问题