[英]weird behavior in android onclick debug mode true false
I found a weird behavior(in my opinion). 我发现了一个奇怪的行为(我认为)。
I created an activity with a simple click action onLogon(View view)
. 我使用
onLogon(View view)
的简单单击操作创建了一个活动。 (No onclick listener!) and in my layout.xml
, I just added a button and used android:onClick="onLogon"
(没有onclick监听器!),在我的
layout.xml
,我仅添加了一个按钮并使用了android:onClick="onLogon"
Running this in debug mode on my android phone (kitkat) was no problem. 在我的android手机(kitkat)上以调试模式运行它没问题。 But as soon as I deployed it without debug mode, this gave errors.
但是,一旦我在没有调试模式的情况下部署它,就会出现错误。
I had to change the onLogon(View view) with an onclick listener to something like this. 我不得不使用onclick侦听器将onLogon(View view)更改为类似的内容。
Button mSignInButton = (Button) findViewById(R.id.btnLogon);
mSignInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
attemptLogin();
}
});
This last way of handling click events seems to work in debug, deploy and when deploying through the play store. 处理点击事件的最后一种方法似乎可以在调试,部署以及通过Play商店进行部署时使用。
I understand why the onclick handler is the prefered way. 我了解为什么onclick处理程序是首选方式。 I don't understand the difference in behavior between debug and non debug.
我不了解调试和非调试之间的行为差异。
Maybe someone can explain this?? 也许有人可以解释这个?
您应该选中此按钮单击事件,您要提供两个单击事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.