Null Pointer Exception when using cursor adapter...please help me to identify it
<p>Here I am saving record and trying to show it in Listview using custom adapter.On button click i am calling getAlldata method.I am getting null pointer exception.</p>

<pre><code>10-31 12:01:22.129: E/AndroidRuntime(758): FATAL EXCEPTION: main
10-31 12:01:22.129: E/AndroidRuntime(758): java.lang.NullPointerException
10-31 12:01:22.129: E/AndroidRuntime(758):  at com.salesforce.android.restsample.CustomAdapter.bindView(CustomAdapter.java:38)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.CursorAdapter.getView(CursorAdapter.java:250)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.AbsListView.obtainView(AbsListView.java:2033)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.ListView.makeAndAddView(ListView.java:1772)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.ListView.fillDown(ListView.java:672)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.ListView.fillFromTop(ListView.java:732)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.ListView.layoutChildren(ListView.java:1625)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.AbsListView.onLayout(AbsListView.java:1863)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.View.layout(View.java:11278)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1617)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1401)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.View.layout(View.java:11278)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1617)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.TableRow.onLayout(TableRow.java:121)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.View.layout(View.java:11278)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.TableLayout.onLayout(TableLayout.java:440)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.View.layout(View.java:11278)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.View.layout(View.java:11278)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.View.layout(View.java:11278)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.View.layout(View.java:11278)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewGroup.layout(ViewGroup.java:4224)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1489)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2442)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.os.Looper.loop(Looper.java:137)
10-31 12:01:22.129: E/AndroidRuntime(758):  at android.app.ActivityThread.main(ActivityThread.java:4424)
10-31 12:01:22.129: E/AndroidRuntime(758):  at java.lang.reflect.Method.invokeNative(Native Method)
10-31 12:01:22.129: E/AndroidRuntime(758):  at java.lang.reflect.Method.invoke(Method.java:511)
10-31 12:01:22.129: E/AndroidRuntime(758):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-31 12:01:22.129: E/AndroidRuntime(758):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-31 12:01:22.129: E/AndroidRuntime(758):  at dalvik.system.NativeStart.main(Native Method)


Button **showOffline** = (Button)findViewById(R.id.show_offline_accounts);
          showOffline.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                    System.out.println("==="+databaseHelper.getAllData());
                    //Cursor c = databaseHelper.getAllData();

    customAdapter = new CustomAdapter(AccountListView.this,databaseHelper.getAllData(), CursorAdapter.NO_SELECTION);
                    //customAdapter.changeCursor(databaseHelper.getAllData());
                    lv.setAdapter(customAdapter);  
            }

          });

public class CustomAdapter extends CursorAdapter {

    public CustomAdapter(Context context,Cursor c,int flags) {
        super(context,c);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {

        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        View retView = inflater
                .inflate(R.layout.single_row, parent, false);

        return retView;
    }


@Override
    public void bindView(View view, Context context, Cursor cursor) {

        TextView textViewPersonName = (TextView) view
                .findViewById(R.id.accountBillingCityEditText);
        textViewPersonName.setText(cursor.getString(cursor
                .getColumnIndex(cursor.getColumnName(1))));

        TextView textViewPersonPIN = (TextView) view
                .findViewById(R.id.accountBillingStateEditText);
        textViewPersonPIN.setText(cursor.getString(cursor.getColumnIndex(cursor
                .getColumnName(2))));
    }      
}




TextView textViewPersonName = (TextView) view.findViewById(R.id.accountBillingCityEditText); 
textViewPersonName.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(1)))); 
</code></pre>
