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
2
votes
2 answers

onDowngrade() method has not been called

I need to override the onDowngrade method, so that calls onDowngrade(), whenever the older version of database in my app replaces the existing version of the app i.e. (newer version db) < (older version db). Example: When I tried to install the…
2
votes
1 answer

onUpgrade in sqlite database in android

I am developing a database application and I am stuck up at one place. The scenario is: I have a database and I am maintaining the version of the database. It is the same as that of the application version. Now I am implementing the database in…
android developer
  • 1,253
  • 2
  • 13
  • 43
2
votes
1 answer

SQLiteOpenHelper, Multiples Tables and ContentProvider

I'm trying to sync data between a webserver and an android app.So, i'm following this great advice: Sync data between Android App and webserver Now, i'm actually working in the first part doing the Content Provider. For this, i found this tutorial:…
ginobilicl
  • 23
  • 4
2
votes
1 answer

Android app updating upgrading debugging

When updating/upgrading an android app, you have to: update the versions in the manifest update the SQLiteOpenHelper's OnUpgrade Method that's it as far as I know I get stuck when I want to debug the upgrade itself The reason for my problem and my…
Amir.F
  • 1,911
  • 7
  • 29
  • 52
2
votes
2 answers

SQLite disk IO exception and can't open database exception

I have gone through other similar questions but I did not get an answer. In my android app I'm opening a pre-built database. It is in the assets folder and copied using SQLiteOpenHelper, if not already present. This the class: import…
Frozen Crayon
  • 5,172
  • 8
  • 36
  • 71
2
votes
2 answers

NullPointerException in ContextWrapper.openOrCreateDatabase when using SQLiteOpenHelper

I'm making a new android application that uses databases. I used similar code to create and copy database, but it's not working for some reason. I can't figure it out, help. LogCat: 07-03 21:38:54.260: E/AndroidRuntime(12172): FATAL EXCEPTION:…
user1816780
  • 121
  • 4
  • 14
2
votes
2 answers

What is the SQLiteOpenHelper version number based upon?

I've got an Android app I'm about ready to release, and I'm reviewing some of my code. I'm worried about my implementation for my SQLiteOpenHelper. Specifically, I want to verify what the oldVersion and newVersion reference in the onUpgrade…
Matt Huggins
  • 81,398
  • 36
  • 149
  • 218
2
votes
2 answers

Insert data into database using AsyncTask

Android 2.3.3 I am new to using AsyncTask, so, my implementation may or may not be right. I have to insert data into database using a AsyncTask. The problem is there are no errors / exceptions, but the database is not being created. I didn't know…
Vamsi Challa
  • 11,038
  • 31
  • 99
  • 149
2
votes
2 answers

Android SQLiteDiskIOException in getReadableDatabase(), native_setLocale, SQLiteOpenHelper

Recently I've run into a problem connected with using SQLiteOpenHelper. Few users reported the error I can't reproduce: android.database.sqlite.SQLiteDiskIOException: disk I/O error at android.database.sqlite.SQLiteDatabase.native_setLocale(Native…
bartull
  • 95
  • 1
  • 5
2
votes
2 answers

Using same instance of SQLiteDatabase across different instances of SQLiteOpenHelper

I need multiple tables in my application. For this I've created separate subclasses of SQLiteOpenHelper to insert/remove/update data for different tables. My question is how can I make sure all these subclasses uses same instance of SQLiteDatabase…
Gaurav Arora
  • 17,124
  • 5
  • 33
  • 44
2
votes
2 answers

Table not created in SQLite Database in Android

Actually the code works well when I created the database, my first table(table_userprofile) and its related fields. But as soon as I created another table(table_bloodgroup) under onCreate() method in my Helper Class. It started to show 2nd table not…
Rushabh
  • 385
  • 2
  • 5
  • 14
2
votes
1 answer

LG cell phones can't access SqLite databases

We have developed an application for the Android platform with a SQLite database preloaded. Using SQLiteOpenHelper, in the first execution of the application, we copy the database from “Assets” for the application data directory (/ data / data /…
2
votes
1 answer

Android design using ListFragment with SQLite database

What is the best way to implement a ListFragment using SQLite database. Currently I have created an DBAdapter to facilitate opening, closing, and fetching records into a SimpleCursorAdapter. I have my MainActivity which implements an ActionBar with…
2
votes
0 answers

ContentProvider.getWriteableDatabase throws NullPointerException

So basically, I'm trying to write a ContentProvider that encapsulates an SQLite database. I've looked everywhere online, followed several different tutorials, and keep on ending up with the same problem. I've noticed quite a few people asking the…
Card
  • 53
  • 5
1
vote
3 answers

Why is DBHelper not closed in the Android notepad tutorial?

I am currently writing my first Android app and have based most of my knowledge on the Android notepad tutorial: http://developer.android.com/resources/tutorials/notepad/notepad-ex3.html In my application I am using multiple DBHelpers in one…
bas
  • 465
  • 5
  • 13