Note that there are some explanatory texts on larger screens.

plurals
  1. POfunny error with my database
    text
    copied!<p>my app is contacts book , finally everything's working fine but when I, "the user", add new contact I get force close .. but the app didn't close, but rather just restarted ! and when i check the contact list i see that what i tried to add is really been added !!! logcat say the error is here :</p> <pre><code>return cursorToContact(cursor); </code></pre> <p>it is part of this add function: </p> <pre><code> /** Add new Contact to Database. */ public Contact createContact(Contact contact) { //Used to store data like : COLUMN_NAME , VALUE. ContentValues values = new ContentValues(); values.put(MySQLiteHelper.COLUMN_FIRST_NAME, contact.getFirstName()); values.put(MySQLiteHelper.COLUMN_LAST_NAME, contact.getLastName()); //Insert new contact and get the id of it. long insertId = database.insert(MySQLiteHelper.TABLE_NAME_FTS, null, values); //To show how to query (To get contact by it id). Cursor cursor = database.query(MySQLiteHelper.TABLE_NAME_FTS, allColumns, MySQLiteHelper.COLUMN_ID + " = " + insertId, null, null, null, null); //Move Cursor to the first row. cursor.moveToFirst(); return cursorToContact(cursor); } </code></pre> <p>so why is that happen > plz help me note that i'm useing sqlite fts3 database</p> <p>the cursorToContact : </p> <pre><code> /** Used to get Contact data from Cursor to Memo Object. */ private Contact cursorToContact(Cursor cursor) { Contact contact = new Contact(); contact.setId(cursor.getLong(0)); contact.setFirstName(cursor.getString(1)); contact.setLastName(cursor.getString(2)); return contact; } </code></pre>
 

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