Both activities are in the same package
Second activity uses second layout file
setContentView(R.layout.main2);
Errors on this line in the Second_Activity.
EditText text1 = (EditText) findViewById(R.id.EditText03);
Here is the layout file for the Second_Activity.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Answer Is : " >
</TextView>
<EditText
android:id="@+id/EditText03"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</EditText>
</LinearLayout>
<Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick"
android:text="Calling an intent" >
</Button>
</LinearLayout>
Here are the errors in the LogCat window
08-01 19:32:20.340: WARN/ResourceType(8875): No package identifier when getting value for resource number 0x00000005
08-01 19:32:20.390: ERROR/AndroidRuntime(8875): Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x5
mail.xml
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="First Number : ">
</TextView>
<EditText
android:id="@+id/EditText01"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</EditText>
<TextView
android:id="@+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Second Number: ">
</TextView>
<EditText
android:id="@+id/EditText02"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</EditText>
secondscreen.xml
<TextView
android:id="@+id/TextView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Answer Is : ">
</TextView>
<EditText
android:id="@+id/main2EditText01"
android:inputType="number"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</EditText>
manifest xml file
<activity android:name=".ActivityTwo"/>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…