lundi 12 octobre 2015

Null pointer exception in fetching data from sqlite databse

private void fetchData2() {
db = helper.getReadableDatabase();
Cursor c = db.query(DBhelper.TABLE2, null, null, null, null, null, null);
adapter = new SimpleCursorAdapter(
            this,
            R.layout.row,
            c,
            new String[]{DBhelper.Amount},
            new int[]{R.id.lbl});
    list.setAdapter(adapter);
}

Here using the "fetchdata" method,I'm fetching data from sqlite database to a listview.

But now It's giving NULL POINTER EXCEPTION.Is that mean,the value didn't inserted to the database??(But I got success message after inserting the value to the database)

10-13 07:47:30.137 11092-11092/com.example.username.god E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{http://ift.tt/1jZYL2j}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2250) at

Aucun commentaire:

Enregistrer un commentaire