当前位置: 代码迷 >> Android >> 生手提问 View cannot be resolved to a type
  详细解决方案

生手提问 View cannot be resolved to a type

热度:75   发布时间:2016-04-28 00:57:14.0
新手提问 View cannot be resolved to a type
Description Resource Path Location Type
View cannot be resolved to a type HelloworldActivity.java /helloworld/src/com/example/helloworld line 22 Java Problem

public void clickHandler(View v)
{
TextView tv = (TextView)findViewById(R.id.textView1);
tv.setText("hell jijgie "+new java.util.Date());
}

一个button 的响应函数

------解决思路----------------------
引用:
Quote: 引用:

第22行。View cannot be resolved to a type HelloworldActivity.java 
你把一个view申明成了HelloworldActivity类型。

import android.view.View;
import android.widget.Button;
忘了加这些导入语句,搞不懂,这些正常不是创建控件也会自动包含吗

要手动import的,不会自动包含,肯定之前都用快捷键的吧。
  相关解决方案