[英]Implementing View.OnClickListener for the activity - method is not overriden
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
. Android Studio警告
Method does not override method from its superclass
,还警告TextsListActivity
应该实现onClick
。 What have I done wrong? 我做错了什么?
The declaration of the method has a lowercase letter " o ", you're really not overriding the one you think you are. 该方法的声明使用小写字母“ o ”,您实际上并没有覆盖您认为的那个。 Keep in mind that the view may or may not be a
Button
, any View
can potentially receive a click
event. 请记住,该视图可能是
Button
,也可能不是Button
,任何View
都可能接收到click
事件。
public void onClick(View v) {} //as opposed to OnClick
onClick(View v)
onClick(View v)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.