Java 错误:找不到符号类视图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23708451/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error: Cannot find symbol class view
提问by user3646937
I'm trying to learn developing Android Apps and I'm following the Training on developer.android.com
我正在尝试学习开发 Android 应用程序,并且正在关注 developer.android.com 上的培训
I've run into quite a bit of a problem while trying to open a new activity when a user clicks a button. I followed the instructions precisely and still can't figure out the problem
当用户单击按钮时尝试打开新活动时,我遇到了很多问题。我严格按照说明操作,但仍然无法弄清楚问题所在
I compiled the code and got an error:
我编译了代码并得到一个错误:
Error:(39, 29) error: cannot find symbol class View
错误:(39, 29) 错误:找不到符号类视图
The code on line 39 is the following:
第 39 行的代码如下:
public void sendMessage (View view) {
I'm using Android Studio 0.5.2.
我正在使用 Android Studio 0.5.2。
Thanks!
谢谢!
回答by Dung Ta
I just ran into this same issue; Sripathi's suggestion worked.
我刚刚遇到了同样的问题;Sripathi 的建议奏效了。
import android.view.View;
worked like a charm. thanks.
像魅力一样工作。谢谢。
回答by shalini singh
I was also facing the same problem. "cannot find symbol class View"
我也面临同样的问题。“找不到符号类视图”
Please import file given below
请导入下面给出的文件
import android.view.View;
in MainActivity.java
file
在MainActivity.java
文件中