Android Null Pointer Exception ExpandableListView Child Click
<p>I have the below code running. Below that is the stacktrace and I have also highlighted the line it is having the issue with. I believe I did everything how I should, but obviously something is wrong. A fresh set of eyes would be nice and could likely easily spot what I have overlooked.</p>

<p>This is line 74</p>

<blockquote>
<pre><code>            Cursor cursor=(Cursor) mscta.getChild(groupPosition,childPosition);
</code></pre>
</blockquote>

<pre><code>   protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);

            setContentView(R.layout.cattest);

            SQLiteDatabase checkDB = null;
            String myPath = DB_PATH + DB_NAME;
            checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);

            Cursor groupCursor = checkDB.rawQuery("SELECT * FROM employees", null);
            mscta = new MySimpleCursorTreeAdapter(
                                                    this,
                                                    groupCursor,
                                                    R.layout.employee_list_item,
                                                    new String[] {"country"},
                                                    new int[] {R.id.country},
                                                    R.layout.employee_list_item,
                                                    new String[] {"name"},
                                                    new int[] {R.id.lastName});
            setListAdapter(mscta);
            checkDB.close();

            getExpandableListView().setOnChildClickListener(this);

    }

    @Override
    public boolean onChildClick(ExpandableListView parent, View v, int groupPosition,
            int childPosition, long id) {
        // use groupPosition and childPosition to locate the current item in the adapter

            Intent intent = new Intent(list.this, com.second.app.Second.class);
            Cursor cursor=(Cursor) mscta.getChild(groupPosition,childPosition);
            intent.putExtra("EMPLOYEE_ID", cursor.getInt(cursor.getColumnIndex("_id")));
            startActivity(intent);

        return true;
    }
</code></pre>

<p>StackTrace</p>

<pre><code>09-11 21:55:05.668: ERROR/AndroidRuntime(193): Uncaught handler: thread main exiting due to uncaught exception
09-11 21:55:05.687: ERROR/AndroidRuntime(193): java.lang.NullPointerException
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at com.browse.app.List.onChildClick(Categories.java:74)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at android.widget.ExpandableListView.handleItemClick(ExpandableListView.java:552)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at android.widget.ExpandableListView.performItemClick(ExpandableListView.java:497)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:1635)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at android.os.Handler.handleCallback(Handler.java:587)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at android.os.Looper.loop(Looper.java:123)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at android.app.ActivityThread.main(ActivityThread.java:4203)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at java.lang.reflect.Method.invokeNative(Native Method)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at java.lang.reflect.Method.invoke(Method.java:521)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
09-11 21:55:05.687: ERROR/AndroidRuntime(193):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>
