Android出错The application has stopped unexpectedly刚开始学Android,编了一个简单的程序,代码如下就出现上面的错误了.是什么原因啊public class Hello extends Activity {/** Called when the activity is first created.*/privat
来源:学生作业帮助网 编辑:作业帮 时间:2024/10/06 18:46:59
Android出错The application has stopped unexpectedly刚开始学Android,编了一个简单的程序,代码如下就出现上面的错误了.是什么原因啊public class Hello extends Activity {/** Called when the activity is first created.*/privat
Android出错The application has stopped unexpectedly
刚开始学Android,编了一个简单的程序,代码如下就出现上面的错误了.是什么原因啊
public class Hello extends Activity {
/** Called when the activity is first created.*/
private Button myButton = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myButton = (Button)findViewById(R.id.myButton);
myButton.setText(R.string.welcome);
}
}
Android出错The application has stopped unexpectedly刚开始学Android,编了一个简单的程序,代码如下就出现上面的错误了.是什么原因啊public class Hello extends Activity {/** Called when the activity is first created.*/privat
没有错的啊,我刚也给你编译过了,你看下是不是main.XML文件中你的Button的id写错了.如果不行自己看下logcat是那出错了,不行就把logcat给我贴出来,我帮你看.