Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid db.update not work if use db.delete first
    text
    copied!<p>I have a strange problem to update a table in my database...forgive me if I can not explain well but I'm a bit confused... The problem is this: I created a table with values, I read this values in my listview..everything works for now..insert and delete values works without problem..now created a loop in a service why do I need to make a comparison between a value and a string of my database and when this comparison is true, I need to change a value in my table..</p> <p>The real problem is this: my <code>db.update</code> works only if not use ... never, the command <code>db.delete</code>... if use it, the <code>db.update</code> not work anymore ..and to make it work again, i need to make a new AVD.</p> <p>how is it possible? my <code>db.delete</code> and id is this:</p> <pre><code>item.getMenuInfo(); id = getListAdapter().getItemId(info.position); public void deleteReg(SQLiteDatabase db ,long id) { db.delete(TabRegistry.TABLE_NAME, TabRegistry._ID + "=" + id, null); } </code></pre> <p>on activity:</p> <pre><code> databaseHelper.deleteReg(db, id); </code></pre> <p>my db.update is this: (positions is a value of <code>getPositions()</code>,for locate a positions with a cursor(always works, even when fails db.update))</p> <pre><code>public void updateReg(SQLiteDatabase db,int positions, String stat) { ContentValues v = new ContentValues(); v.put(TabRegistry.STATUS, stat); db.update(TabRegistry.TABLE_NAME, v, TabRegistry._ID + " = " + positions, null); } </code></pre> <p>on service:</p> <pre><code> databaseHelper.updateReg(db, positions, "SUCCESS"); </code></pre> <p>if you need more code, tell me what I add now..thanks in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload