Reputation: 105517
Here is my activity code:
public class TextsListActivity extends ActionBarActivity implements View.OnClickListener {
@Override
public void OnClick(View button) {
}
}
Android Studio warns that Method does not override method from its superclass
and also another warning that TextsListActivity
should implement onClick
. What have I done wrong?
Upvotes: 1
Views: 124
Reputation: 21112
The declaration of the method has a lowercase letter "o", you're really not overriding the one you think you are. Keep in mind that the view may or may not be a Button
, any View
can potentially receive a click
event.
public void onClick(View v) {} //as opposed to OnClick
onClick(View v)
Upvotes: 2