简体   繁体   English

我在 Android 代码中做错了什么?

[英]What have I done wrong in the Android code?

I've followed a tutorial for a basic local login screen and despite following the tutorial exactly, I've hit some errors.我遵循了基本本地登录屏幕的教程,尽管完全遵循教程,但我遇到了一些错误。 I don't know exactly what they mean or how to solve them, could anybody help out?我不知道它们的确切含义或如何解决它们,有人可以帮忙吗?

http://imageshack.us/f/856/codeo.jpg/ - This is a screenshot of my current code. http://imageshack.us/f/856/codeo.jpg/ - 这是我当前代码的截图。

Thank you.谢谢你。

Your btn.setOnClickListener(View.OnClickListener) requires View.OnClickListener object but you're passing it DialogInterface.OnClickListener object.您的btn.setOnClickListener(View.OnClickListener)需要View.OnClickListener object,但您传递的是DialogInterface.OnClickListener object。 Hence why your code doesn't compile.因此,为什么您的代码无法编译。

You have confused the View.OnClickListener with the DialogInterface.OnClickListener .您将View.OnClickListenerDialogInterface.OnClickListener混淆了。 You have also confused pasting text with posting blurry low res images of code in the cloud:-D您还将粘贴文本与在云中发布模糊的低分辨率代码图像混淆了:-D

Use new View.OnClickListener .使用new View.OnClickListener It is different the DialogInterface.OnClickListener which you probably imported.它与您可能导入的DialogInterface.OnClickListener不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM