Question

Well I am updating my database with this code:

ContentValues newValues = new ContentValues();
        newValues.put("tamam", true);
        SQLiteDatabase db = mContext.openOrCreateDatabase(DB_NAME,
            Context.MODE_WORLD_WRITEABLE, null);
    return db.update(channel, newValues, "id =" + id , null);

it returns 1;

this is my return code:

if(msoru.isSolved()!= true){
            TestAdapter mDbHelper = new TestAdapter(getActivity());
            mDbHelper.createDatabase();
            mDbHelper.open();
            int truefalse = mDbHelper.updatecheck(mNum2);
            boolean truefalse2 =  msoru.isSolved();

but if I try to read new value it shows old value. I think there is no change

Was it helpful?

Solution

At the end of the database update method I should update also the my arrayclass with this

myArrayclass.get(mContext).setsolved(id);
            db.close();

at last it look like this:

public void updatecheck(int id) {


    ContentValues newValues = new ContentValues();
    int ok = 1;
    String sutun = "tamam";
    newValues.put(sutun, ok);
    SQLiteDatabase db = mContext.openOrCreateDatabase(DB_NAME,
            Context.MODE_PRIVATE, null);
    db.update(tablename, newValues, "id = ?",
            new String[] { String.valueOf(id) });
    myArrayclass.get(mContext).setsolved(id);
    db.close();

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top