Trying to pass an int between two classes on Android platform
<p>I'm trying to pass an int between two classes using a bundle. I have looked online and it seems like it should be easy to do, its just not working for me :( any help is much appreciated! I am trying to pass the int life from one page to another in a simple game.</p>

<p>here is the code for the first page where I am passing it from </p>

<pre><code>int life = 5;

....

if(input.equalsIgnoreCase(teststr))
                {
                    Intent i = new Intent("com.name.PAGETWO");
                    i.putExtra("com.name.PAGETWO.life", life);
                    startActivity(i);
                    mpButtonClick.stop();
}
</code></pre>

<p>And on the second page, trying to receive the int </p>

<pre><code>Intent i = new Intent("com.name.PAGETWO");
Bundle extras = i.getExtras();
int temp2 = extras.getInt("life");
int life = temp2;
</code></pre>

<p>when i try to run it, it tries to go on to the second page and then just says the application has unexpectedly stopped, but when i comment out the code it continues running as normal, so i know i am definitely putting in the code here wrong somewhere. thanks in advance!</p>
