tags:

views:

40

answers:

1

I am creating a project in which i need to take in some numbers, makes some calculations and then on a new screen create show the answers. I am using an Intent object to go to the new screen:

   final Button button = (Button) findViewById(R.id.save);

   button.setOnClickListener(new OnClickListener() 
   {
       public void onClick(View v)
       {
           Intent myIntent = new Intent();
           myIntent.setClass(HelloAndroid.this, screen2.class);
           myIntent.putExtra("eFiber", Double.toString(E_fiber));
           startActivity(myIntent); 
       }
   });

but when i do this it crashes when i click the button. If i use the same xml file as i do in the first screen then it works just fine, its when i use a different xml file that i have the problems.

+1  A: 

Have you registered your second Activity as an Activity in the android-manifest xml?

Under the <application> node, something to the effect of:

<activity android:name=".my.screen2" android:label="@string/app_name"></activity>

With your specific Activity information in place of ".my.screen2"

Quintin Robinson
yes i did add that here is what i wrote: <activity android:name="com.example.helloandroid.screen2" android:label="@string/calculations"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity>i am somewhat unsure of how the intent filter stuff works so is it possible that is screwing it up?
Jennifer