Questions tagged [sqliteopenhelper]

SQLiteOpenHelper is a class from the Android SDK which can be used for easier handling of a SQLiteDatabase.

Using the SQLiteOpenHelper only requires implementing its two abstract methods(other methods for different events can be implemented if the user chooses) onCreate(used for initializing the database) and onUpgrade(used when the database is being changed). The Android system will call this methods according to the state of the database( not created/created/upgrading) and in return, it will offer the user a valid SQLiteDatabase reference with the methods getWritableDatabase() and/or getReadableDatabase(). More information can be found in the documentation for the SQLiteOpenHelper class.

801 questions
3
votes
1 answer

On upgrade method not getting called in android sqlite

I'm using prepopulated sqlite database in my app and i'm trying to update my database in my android application but the onUpgrade method doesn't get called when I increment the version number. i tried googling, searched on stackoverflow but nothing…
3
votes
2 answers

onCreate() of RoomDatabase.Callback() was not called after a successful call to .build()

I have created MovieDatabase using Room Persisdent lib. According to the documentation of onCreate() method in RoomDatabase.Callback, onCreate() to be called after the database is created for the first time, and all the tables were created. What…
3
votes
2 answers

Room: java.lang.IllegalStateException: Migration didn't properly for existing Database

Room version used:- 1.1.1-rc1 I had an existing database which is implemented by ormlite. I am trying to migrate to Room with the existing sqlite file generated by ormlite. When we used long datatype for table column in ormlite it gets coverted to…
3
votes
2 answers

How to create a cursor from a custom database helper

I'm going through Griffith's Head First: Android Development book and a certain code is throwing a Cannot resolve Symbol error. I am building a cursor from the custom database helper as per the instruction of the book. This is the code that is…
Onur-Andros Ozbek
  • 2,998
  • 2
  • 29
  • 78
3
votes
3 answers

Update SQLite table without losing previous data in android

I am trying to add a new column in old sqlite database tables. The tables are dynamic. I mean they are created when app users add a specific data in the app. The tables names have a similar suffix. Prefix depends upon user input. Now, in android,…
Newaj
  • 3,992
  • 4
  • 32
  • 50
3
votes
1 answer

Not getting SQLite tables on specific device brand ZTE-Z982 N9560

We are getting the SQLite exception of "No such Table found". This issue is only reported on the device with brand ZTE(Z982 & N95630). On all other device the DB is working fine so not able to reproduce. Is ther issue with the Database path? Below…
Sandy_4693
  • 128
  • 7
3
votes
3 answers

Are Sqlite Insert , Delete, Synchronous in android

In my android application , i am doing SQlite DB operations like insert, delete, update records. i want to know , if i do like below: long t1 = System.currentTimeMillis(); for(i =0; i
Pardeep Kr
  • 479
  • 2
  • 6
  • 25
3
votes
3 answers

Is it possible to use SQLiteOpenHelper to create DB in cache dir?

I would like to create a database in cache so it could be wiped out when user clicks Clear cache button. In SQLiteOpenHelper constructor there is only argument to pass a name of database, not a directory (default is dadabases). Is there any option…
pixel
  • 24,905
  • 36
  • 149
  • 251
3
votes
2 answers

SQLiteCantOpenDatabaseException: unknown error (code 14) Could not open database

I'm getting this error when I'm trying to get a readable or writable database. "SQLiteCantOpenDatabaseException: unknown error (code 14) Could not open database" I'm having this weird problem with SQLiteOpenHelper and I've seen some similars answer…
Totalys
  • 445
  • 2
  • 10
  • 25
3
votes
3 answers

How to read data from database in assets without copying

In database file (in assets) I need read some date without copying this databse on device. I didnt find answer in google for correct work. Is it possible?
MyNameIs
  • 832
  • 1
  • 8
  • 19
3
votes
1 answer

SQLiteOpenHelper How to update and delete data from table?

I created a database for students with fields Name, surname, marks and I did insert and view sucessfully but I don't know how to do Update and Delete. Please help here I want to do update and delete based on ID.
Karthick
  • 584
  • 4
  • 25
3
votes
1 answer

SQLiteOpenHelper problems

I have been working with Android and SQLite Database to develop an application. But I am having a few problems. This is my code: SQLiteHelperMoney SQLiteHelperMoney1 = new SQLiteHelperMoney(this, null, null, 1); SQLiteDatabase…
user007
  • 2,156
  • 2
  • 20
  • 35
3
votes
2 answers

How can i encrypt particular column data in Android SQLite Data base.Using SQLCipher utility

I have a SQLite DB in android, and I want to encrypt only few columns in that DB. I founded that its available with whole DB to encrypt, but I need to encrypt only few columns data only.
Hari Enaganti
  • 359
  • 1
  • 4
  • 12
3
votes
6 answers

Updating SQLite database when releasing new version of the android app on the store

I'm using sqlite in my android app, my database file is called data.db. Let's suppose that I have two table in it one is having static values(read only) and second is saves dynamic values and pushed the app to the playStore. In the next version I…
Pankaj
  • 346
  • 1
  • 3
  • 15
3
votes
2 answers

Failed to read row 0, column 0 from a CursorWindow which has 0 rows, 64 columns

I sometime get this error in my logcat. Failed to read row 0, column 0 from a CursorWindow which has 0 rows, 64 columns. First, a bit of a back story. I have an app that runs on many devices in our organisation. Primarily, it currently runs on…
Janpan
  • 2,164
  • 3
  • 27
  • 53