tags:

views:

28

answers:

1

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

    <TextView
            android:id="@+id/TextView01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

android:text="Answer Is : ">

    <EditText
            android:id="@+id/EditText03"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
    </EditText>

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"/>

A: 

There's something syntactically wrong with your XML files that's stopping your ids in R from being generated. Could you post the rest of your XMLs? Maybe you're missing a close tag or something.

Andy Zhang
new here not sure how to put the xml files in as a reply
Dean-O
Oh; pasting it in your question is fine. :)
Andy Zhang
Hmm.. I can't see anything wrong with what you posted; Did you put your views in a layout (is the layout xml correct?)?
Andy Zhang
I changed it from an EditText to a TextFiled and it worked just fine. Odd
Dean-O
typo on my part in the xml file did not see the red x in the circle yes I am human... this and many other things prove it
Dean-O