lundi 10 août 2015

SQLiteException attempt to re-open an already-closed object: SQLiteDatabase

I am trying to add an update method to update user information. Here is my update method:

//updating sqlite database with the group name
    public void updateUserGroup(String groupName) {

        SQLiteDatabase db = this.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put(KEY_GROUP, groupName);
        HashMap<String, String> user = getUserDetails();
        String userID = user.get("uid");

        System.out.println("User id is: " + userID);
        db.update(TABLE_LOGIN, values, SQLiteHandler.KEY_UID + "=\"" + userID + "\"", null);
    }

Here is the error:

 java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase: /data/data/http://ift.tt/1UznSpA
            at android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:55)
            at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1545)
            at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1522)

Aucun commentaire:

Enregistrer un commentaire