public class Activity01<Button> extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView myTextView=(TextView)findViewById(R.id.myTextView);
Button myButton=(Button)findViewById(R.id.myButton);
myTextView.setText("我的第一个TextView");//运行时出错
myButton.setText("我的第一个Button");//运行时出错
}
}错误信息如下:
The left-hand side of an assignment must be a variable ;
Syntax error on token "Invalid Character", invalid AssignmentOperator;
Syntax error on token "Invalid Character", ; expected
求高手指教,不胜感激
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView myTextView=(TextView)findViewById(R.id.myTextView);
Button myButton=(Button)findViewById(R.id.myButton);
myTextView.setText("我的第一个TextView");//运行时出错
myButton.setText("我的第一个Button");//运行时出错
}
}错误信息如下:
The left-hand side of an assignment must be a variable ;
Syntax error on token "Invalid Character", invalid AssignmentOperator;
Syntax error on token "Invalid Character", ; expected
求高手指教,不胜感激
解决方案 »
- 给gps定位activity 添加一个broadcastreciever 短信监听 如何实现??
- AlarmManager setRepeating问题
- android中jni调用时,出现问题。
- 如何给这样的一个列表对话框设置大小和设置字体大小。请教了。。
- 如网页中的效果,我想在android上实现,求高手给思路
- 大侠们...快出来帮帮小弟!android 怎么获取手机自己的IP?````````
- 请教高手一个问题!!!!!!!!!!!!!
- 关于SearchManager的问题?
- 安卓安装一个apk时如何把其他几个apk也装上
- ListView 默认选中第X个高亮
- 有关viewgroup的程序问题
- 请教如何将settings里面的内容去掉一部分
myButton.setText("我的第一个Button");//运行时出错
不会 中英文符号的问题吧
myButton.setText("我的第一个Button");//运行时出错
那两个冒号用英文输入时输入,重输一下
The method setText(String) is undefined for the type Button
求指教
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView myTextView=(TextView)findViewById(R.id.myTextView);
Button myButton=(Button)findViewById(R.id.myButton);//运行时出错
myTextView.setText("我的第一个TextView");
myButton.setText("我的第一个Button");
}
}
改正后运行还是出错:
Button cannot be resolved to a type
问题解决