title: Pass integer variable to from one activity to another activity in android
body: <p>Am passing my integer variable from FirstPage to FifthPage, i can see 0 in my toast not the actual value stored in 'q1'. How can i pass my integer variable from one activity to other activity?
  Can any one help me....thanks</p>
  
  <pre><code>FirstPage.java
  
  int pos =poltype.getSelectedItemPosition();
  int q1=pos;
  Intent myIntent = new Intent(context1, FifthPage.class);
  myIntent.putExtra("Q1", (int)q1);                      
  
  Intent myintent2 = new Intent(context1, SecondPage.class);
  startActivity(myintent2);
  
  
  FifthPage.java
  
  Intent mIntent = getIntent();
  int Q1 = mIntent.getIntExtra("Q1", 0);
  
  Toast.makeText(FifthPage.this,
  String.valueOf(Q1), Toast.LENGTH_LONG)
                             .show();
  </code></pre>
  
  <p>Log cat:</p>
  
  <pre><code>05-19 16:06:44.557: E/AndroidRuntime(2922): FATAL EXCEPTION: main
  05-19 16:06:44.557: E/AndroidRuntime(2922): Process: com.example.techback, PID: 2922
  05-19 16:06:44.557: E/AndroidRuntime(2922): android.content.res.Resources$NotFoundException: String resource ID #0x0
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at android.content.res.Resources.getText(Resources.java:274)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at android.widget.Toast.makeText(Toast.java:277)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at com.example.techback.FifthPage$1.onClick(FifthPage.java:50)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at android.view.View.performClick(View.java:4756)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at android.view.View$PerformClick.run(View.java:19749)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at android.os.Handler.handleCallback(Handler.java:739)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at android.os.Handler.dispatchMessage(Handler.java:95)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at android.os.Looper.loop(Looper.java:135)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at android.app.ActivityThread.main(ActivityThread.java:5221)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at java.lang.reflect.Method.invoke(Native Method)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at java.lang.reflect.Method.invoke(Method.java:372)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
  05-19 16:06:44.557: E/AndroidRuntime(2922):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
  </code></pre>