dimanche 19 juillet 2015

App crashes between onPause and onResume Listview issue

I have a listview activity which populates data through an sqlite database; however, whenever I enter onPause and then go into onResume my app crashes and I receive this error: "java.lang.IllegalStateException: trying to requery an already closed cursor android.database.sqlite.SQLiteCursor@418106a8". Would anyone know how to stop this? Is there a method I have to call in onPause?

        @Override
protected void onResume() {
    super.onResume();
    uGraduateListAdapter = new ArrayAdapter<String>(ListOfAlarms.this, android.R.layout.simple_list_item_1, populateList());
    listOfAlarms.setAdapter(uGraduateListAdapter);
    Log.i(TAG, "Resume was called");
}

@Override
protected void onPause() {
    super.onPause();

    Log.i(TAG, "Pause was called");
    sqliteDatabase.close();
}

Aucun commentaire:

Enregistrer un commentaire