,android虚拟机运行时显示以下信息
求助,android虚拟机运行时显示以下信息:
Sorry!The application Menu02(process com.amaker.test)has stopped unexpectedly.Please try again.
Force close
------解决方案--------------------
晕倒
private Button b1,b2;
应该改为
private TextView b1;
private Button b2;
------解决方案--------------------
b1=(Button)findViewById(R.id.TextView01);
改为
b1=(TextView)findViewById(R.id.TextView01);
------解决方案--------------------
要修改main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str1"></Button>
<Button android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str2"></Button>
</LinearLayout>
Sorry!The application Menu02(process com.amaker.test)has stopped unexpectedly.Please try again.
Force close
------解决方案--------------------
晕倒
private Button b1,b2;
应该改为
private TextView b1;
private Button b2;
------解决方案--------------------
b1=(Button)findViewById(R.id.TextView01);
改为
b1=(TextView)findViewById(R.id.TextView01);
------解决方案--------------------
要修改main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str1"></Button>
<Button android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/str2"></Button>
</LinearLayout>