NullPointException Don't Know Why?
<p>please have a look at this code and see if you could help me out. viewItem is populating from a database and the method fillRemindersData(long rowId) is only called from the reminder class. I don't know why i am getting a nullPointerException when calling the viewitems.fillRemindersData()method. if i comment the line, the code works fine and the rowId is correct. what could be the reason? thanks</p>

<pre><code>// this is a reminder class
public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_list);
        adapter = new DBAdapter(this);
        viewItems = new ViewItems();
        fillReminder();     
    }

    private void fillReminder() {
        Bundle extra = getIntent().getExtras();
        if(extra != null){
            rowId = extra.getLong(DBAdapter.KEY_ID);


            message = extra.getString(NewItem.Test);
        }
        Toast.makeText(this, message + "its ok here" + rowId, Toast.LENGTH_LONG).show();
        viewItems.fillRemindersData(rowId); // having a null pointer exception here.
}
</code></pre>

<p>And important part of the viewItems class is: </p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.view_list);
        adapter = new DBAdapter(this);
        adapter.open();
        fillData();
        list = (ListView)findViewById(android.R.id.list);
        list.setOnItemClickListener(this);


    }

 protected void fillData() {

 Cursor c = adapter.retrieveItems(); // method in sqlitedatabase
 startManagingCursor(c);

String[] from = new String[]{DBAdapter.NAME, DBAdapter.START_DATE, DBAdapter.START_TIME};
int[] to = new int[]{R.id.viewNameId, R.id.viewDateId, R.id.viewTimeId};

customCursorAdapter items = new customCursorAdapter(this, R.layout.view_items, c, from, to);
                setListAdapter(items);          

    }

 protected void fillRemindersData(long Id) {
 long row = Id;
 Cursor c = adapter.retrieveRow(row); // method in sqlitedatabase
 startManagingCursor(c);

String[] from = new String[]{DBAdapter.NAME, DBAdapter.START_DATE, DBAdapter.START_TIME};

int[] to = new int[]{R.id.RemindNameId, R.id.remindDateId, R.id.remindTimeId};

customCursorAdapter items = new customCursorAdapter(this, R.layout.remind_viewer, c, from, to);
setListAdapter(items);          

    }
</code></pre>

<p>method the logcat is referring to:</p>

<pre><code>public Cursor retrieveRow(long rowId){
String[] resultColumns = new String[] {NAME,START_DATE,START_TIME};
Cursor row = db.query(true,DATABASE_TABLE, resultColumns, KEY_ID +"=" +rowId, null, null, null, null,null);
     if(row != null){
    row.moveToNext();
          return row;
    }
    return row;
     }
</code></pre>

<p>Logcat output:</p>

<pre><code>09-22 15:19:00.346: ERROR/AndroidRuntime(808): Uncaught handler: thread main exiting due to uncaught exception
09-22 15:19:00.386: ERROR/AndroidRuntime(808): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MemoBuzz/com.MemoBuzz.RemindViewer}: java.lang.NullPointerException  


    09-22 15:19:00.386: ERROR/AndroidRuntime(808): Caused by: java.lang.NullPointerException

    09-22 15:19:00.386: ERROR/AndroidRuntime(808):     at com.MemoBuzz.ViewItems.fillRemindersData(ViewItems.java:57)

    09-22 15:19:00.386: ERROR/AndroidRuntime(808):     at com.MemoBuzz.RemindViewer.fillReminder(RemindViewer.java:51)

    09-22 15:19:00.386: ERROR/AndroidRuntime(808):     at com.MemoBuzz.RemindViewer.onCreate(RemindViewer.java:36)

    09-22 15:19:00.386: ERROR/AndroidRuntime(808):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)

    09-22 15:19:00.386: ERROR/AndroidRuntime(808):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)

    09-22 15:19:00.386: ERROR/AndroidRuntime(808):     ... 11 more
</code></pre>
