Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, There are so many problems with the code, that I think you must have a better look at SQLite structure in android, technically, <strong>Android SQLite</strong> and <strong>SQLCipher</strong> look totally the same (except for the password). so if you write an standard SQLite application, it can be changed to SQLCipher easily,</p> <p>I suggest you read this fine article about SQLite in android,</p> <p><a href="http://www.vogella.com/articles/AndroidSQLite/article.html" rel="nofollow">http://www.vogella.com/articles/AndroidSQLite/article.html</a></p> <p><strong>Tip</strong>: There is no need to call <strong>openOrCreateDatabase</strong> when you are using <strong>SQLiteOpenHelper</strong>, calling <strong>getWritableDatabase</strong> would do the job, also you must be having a <strong>SQLiteDatabase</strong> object which is taken from <strong>getWritableDatabase</strong> method, calling <strong>getWritableDatabase</strong> for every time you want to insert a record is not right.</p> <p>these parts would be removed, </p> <pre><code> // in onCreate method File file = getDatabasePath(DatabaseClass.DATABASE_NAME); file.mkdir(); file.delete(); sqldb = SQLiteDatabase.openOrCreateDatabase(file,key, null); db = new DatabaseClass(this); // in saveData method db.getWritableDatabase(key).insert("mylistdata", DatabaseClass.NAME , insertData); </code></pre> <p>Instead you must do something like this</p> <pre><code> // in onCreate method try{ sqldb = new DatabaseClass(this).getWritableDatabase(key); }catch(Throwable e){ // error occurred } // in insert action try{ sqldb.insert("tablename", null, contentValues); }catch(Throwable e){ // error occurred } </code></pre> <p>This way you can also see if an error occurred, Remember, not to use <strong>Exception</strong> class on the catch phrase, only <strong>Throwable</strong>! </p> <p>Also, I would not suggest to close the connection on every insert action, It's better to be taken care of in higher levels</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

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