title: Passing long with an intent, always getting error
body: <p>I need to pass a long (_id) with an intent from Activity A to Activity B, using this code:</p>
  
  <pre><code>Intent vip0= new Intent(this, PageSinglePlayerGuess.class);
  vip0.putExtra("resid", (long) 1);
  startActivity(vip0);
  </code></pre>
  
  <p>and getting it in Activity B with this method (called in onCreate()):</p>
  
  <pre><code>public long getResId() {
      Intent i= getIntent();
      resid= i.getLongExtra("resid", 1);
      Log.d("D", "Risorsa: " + resid);
      return resid;
  }
  </code></pre>
  
  <p>resid in ActB is a long.
  I get this error: </p>
  
  <pre><code>    06-06 11:10:47.138: W/Bundle(538): Key resid expected Long but value was a java.lang.Integer.  The default value 1 was returned.
      06-06 11:10:47.158: W/Bundle(538): Attempt to cast generated internal exception:
      06-06 11:10:47.158: W/Bundle(538): java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
      06-06 11:10:47.158: W/Bundle(538):  at android.os.Bundle.getLong(Bundle.java:966)
      06-06 11:10:47.158: W/Bundle(538):  at android.content.Intent.getLongExtra(Intent.java:3874)
      06-06 11:10:47.158: W/Bundle(538):  at com.gmail.corsalini.celebrityquiz.PageSinglePlayerGuess.getResId(PageSinglePlayerGuess.java:60)
      06-06 11:10:47.158: W/Bundle(538):  at com.gmail.corsalini.celebrityquiz.PageSinglePlayerGuess.onCreate(PageSinglePlayerGuess.java:46)
      06-06 11:10:47.158: W/Bundle(538):  at android.app.Activity.performCreate(Activity.java:4465)
      06-06 11:10:47.158: W/Bundle(538):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
      06-06 11:10:47.158: W/Bundle(538):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
      06-06 11:10:47.158: W/Bundle(538):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
      06-06 11:10:47.158: W/Bundle(538):  at android.app.ActivityThread.access$600(ActivityThread.java:123)
      06-06 11:10:47.158: W/Bundle(538):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
      06-06 11:10:47.158: W/Bundle(538):  at android.os.Handler.dispatchMessage(Handler.java:99)
      06-06 11:10:47.158: W/Bundle(538):  at android.os.Looper.loop(Looper.java:137)
      06-06 11:10:47.158: W/Bundle(538):  at android.app.ActivityThread.main(ActivityThread.java:4424)
      06-06 11:10:47.158: W/Bundle(538):  at java.lang.reflect.Method.invokeNative(Native Method)
      06-06 11:10:47.158: W/Bundle(538):  at java.lang.reflect.Method.invoke(Method.java:511)
      06-06 11:10:47.158: W/Bundle(538):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
      06-06 11:10:47.158: W/Bundle(538):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
      06-06 11:10:47.158: W/Bundle(538):  at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  
  <p>Any idea how to solve this? (it seems really easy, but i just can't get out of it)</p>