Issue passing an ID from an Intent
<p>I'm currently getting a null pointer exception error whilst passing an ID over an intent. I have marked on the code where the errors seems to be occuring.</p>

<p>Hopefully someone can see where im going wrong.</p>

<p>Here's my code that adds the selected ID (from a listview) to an intent:</p>

<pre><code>    public void onListItemClick(ListView list, View v, int list_posistion, long item_id)
{
    long idToPass = item_id;


    Intent setName = new Intent("com.example.flybase2.addAppointment");
    setName.putExtra("passedID", idToPass);
    startActivity(setName);  
}
</code></pre>

<p>Heres the class that the intent opens showing the bundle that contains the passed ID:</p>

<pre><code>//ERROR: Error occuring on this bundle when setting the ID variable.
Bundle passedID = getIntent().getExtras(); 
    if (passedID != null) {
     ID = passedID.getLong("passedID"); 



    DBHandlerApp NameAppointPass = new DBHandlerApp(this, null, null);

    NameAppointPass.open();
    String nameReturned = NameAppointPass.getName(ID);

    setName.setText(nameReturned);
}
</code></pre>

<p>LogCat:</p>

<pre><code>01-21 19:14:16.808: E/AndroidRuntime(274): FATAL EXCEPTION: main
01-21 19:14:16.808: E/AndroidRuntime(274): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.flybase2/com.example.flybase2.addAppointment}: java.lang.NullPointerException
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.os.Looper.loop(Looper.java:123)
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.app.ActivityThread.main(ActivityThread.java:4627)
01-21 19:14:16.808: E/AndroidRuntime(274):  at java.lang.reflect.Method.invokeNative(Native Method)
01-21 19:14:16.808: E/AndroidRuntime(274):  at java.lang.reflect.Method.invoke(Method.java:521)
01-21 19:14:16.808: E/AndroidRuntime(274):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-21 19:14:16.808: E/AndroidRuntime(274):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-21 19:14:16.808: E/AndroidRuntime(274):  at dalvik.system.NativeStart.main(Native  Method)
01-21 19:14:16.808: E/AndroidRuntime(274): Caused by: java.lang.NullPointerException
01-21 19:14:16.808: E/AndroidRuntime(274):  at com.example.flybase2.addAppointment.onCreate(addAppointment.java:57)
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-21 19:14:16.808: E/AndroidRuntime(274):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
</code></pre>
