Error when creating entry into SQLdatabase
<p>I keep getting this error </p>

<pre><code>07-19 14:24:50.840: ERROR/AndroidRuntime(1512): java.lang.NullPointerException
07-19 14:24:50.840: ERROR/AndroidRuntime(1512):     at com.fttech.organizeit.TaskHelper.createLunch(TaskHelper.java:76)


07-19 14:24:50.840: ERROR/AndroidRuntime(1512):     at com.fttech.organizeit.TaskDetails.saveState(TaskDetails.java:260)
</code></pre>

<p>Here is my createLunch()</p>

<pre><code>}
    public long createTask(String title, String descrip, String type, String taskdatetime){
        ContentValues initialValues = new ContentValues();
        initialValues.put(KEY_TITLE, title);
        initialValues.put(KEY_DESCRIP, descrip);
        initialValues.put(KEY_TYPE, type);
        initialValues.put(KEY_DATE_TIME, taskdatetime);

        return mDb.insert(DATABASE_TABLE, null, initialValues);
    }
</code></pre>

<p>It gives me a error at createLunch before saveState so im pretty sure the error lies here. Its pointing me to my return statement. i just dont see what the problem is.</p>

<p>Im seeing the lob.v for saved here. but not for inserted into database. i think the error lies here </p>

<pre><code>Log.v(title, "saved");

    SimpleDateFormat dateTimeFormat = new SimpleDateFormat(DATE_TIME_FORMAT);
    String taskdatetime = dateTimeFormat.format(mCalendar.getTime());
    if(taskId == null){
        long id = helper.createTask(title, descrip, type, taskdatetime);
        Log.v(taskdatetime, "Inserted into databse");
        if(id &gt;0){
            taskId = id;
        }
    }
    else{
        helper.updateTask(taskId, title, descrip, type, taskdatetime);
    }

    finish();


}
</code></pre>

<p>}</p>

<pre><code>public void fillData(){
            helper.open();
            Cursor task = helper.fetchAllTask();
            startManagingCursor(task);

            String[] from = new String[]{TaskHelper.KEY_TITLE};
            int[] to = new int[]{R.layout.row};

            SimpleCursorAdapter taskAdapter = new SimpleCursorAdapter(this, R.layout.list, task, from , to);
            setListAdapter(taskAdapter);

        }
</code></pre>
