The following code generates this error message in the line public void onClick .
Several markers on this line
- implements android.view.View.OnClickListener.onClick
- The onClick (View) method of type new View.OnClickListener () {} should override the superclass method
I do not understand why. This code is taken from numerous examples that I have seen. What could be wrong?
private Button audioButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); audioButton = (Button) findViewById(R.id.imageButton1); audioButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View button) { if (button.isSelected()) { button.setSelected(false); } else { button.setSelected(true); } } }); }
java android compiler-errors
Richard Eng Jan 02 2018-12-12T00: 00Z
source share