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
1 answer

Download and create sqlite db from cvs/txt file

I am trying to download a operator specific db when the app is first time opening. Since its operator specific, I cannot bundle this db as part of apk. I have implemented a way to use DownloadManager to download the my_operator_specif_db.db and then…
nizam.sp
  • 4,002
  • 5
  • 39
  • 63
2
votes
2 answers

Trouble with SqLite Journal files. "file is encrypted or is not a database"

I still have a lot of trouble handling multiple SQLite DB-files. Every DB-file has its own journal-file, which I assumed should disappear, once the writing is done. In fact they stay, so that I'm in trouble deleting the DB-file, because the…
RuNaWaY87
  • 689
  • 1
  • 5
  • 12
2
votes
1 answer

SQLiteOpenHelper onCreate running twice?

In my database handler class (extends SQLiteOpenHelper) I have the onCreate() Method: @Override public void onCreate(SQLiteDatabase db) { db.execSQL(CREATE_TABLE_TASKS); db.execSQL(CREATE_TABLE_CONTACTS); } Sometimes (very rarely, but…
TimSim
  • 3,936
  • 7
  • 46
  • 83
2
votes
2 answers

How can I split a long, single SQLiteOpenHelper into several classes, one for each table

I know this has been asked a couple of times before, but in all those questions neither the OP's nor the people who answered, provided clear examples. So what I'm trying to ask here is if having a class like this public class MyDatabaseDB { //…
eddy
  • 4,373
  • 16
  • 60
  • 94
2
votes
2 answers

Android SQLiteOpenHelper time-consuming onCreate, need progress bar on first run

The first time my app runs it creates a database in which it loads 6,000 rows from a file in /res/raw. I can't do this asynchronously as the app depends on it entirely. It runs rapidly on my phone - a Moto X - but it's really slow in all my…
Philippe Le Point
  • 255
  • 1
  • 3
  • 13
2
votes
1 answer

How can I write SQLite Real vals to Java BigDecimal values?

I have a class like this: public class DeliveryItem { private int _id; private String _invoiceNumber; private String _UPC_PLU; private String _vendorItemId; private int _packSize; private String _description; private…
2
votes
3 answers

Android - SQLiteDatabase no such table error(code 1)

I've a ListView in my app to which the user can Add/Remove items. I'm using SQLiteDatabase to store the items when app is not in use but, the SQLiteDatabase giving me a strange error saying "No such table found:subjects(code 1). I can't figure out…
Swap
  • 480
  • 2
  • 7
  • 21
2
votes
1 answer

Why am I getting, "incompatible types: Bla cannot be converted to Context" in my SQLiteOpenHelper constructor?

I'm implementing SQLite functionality into my Android project, using this tutorial. I've got this SQLiteOpenHelper code: public class HHSSQLiteHandler extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; private static…
2
votes
1 answer

Sqliteopenhelper not calling onCreate for sqlcipher

I have read SQLcipher guid, and all steps are done under the guidance. The onCreate() in SQliteOpenHelper is never been called. Many ways have been tried, all doesn't work. Any help will be appreciated. The code is following: package…
Sysphus
  • 194
  • 1
  • 3
  • 11
2
votes
2 answers

sqlite.SQLiteException: near "s": syntax error: because of apostrophe

The song name that I want to insert it into my table contains a " ' " (apostrophe )so , there is an error when the request is excuted. How can I fix it Cursor pid = mDB.rawQuery("select Id FROM MusicPlayer WHERE "Path ='" + sname + "';", null); I…
Shakeeb Ayaz
  • 6,200
  • 6
  • 45
  • 64
2
votes
1 answer

Content Provider no such table

I am totally lost... here is my code: public class MainContentProvider extends ContentProvider { //DataBase private WordsOpenHelper db_words; private CategoryOpenHelper db_category; //helper Strings to build the URI private static String AUTHORITY…
2
votes
2 answers

Android APP crashes on getWritableDatabase() or getReadableDatabase()

I am php developer, trying to learn android and I am trying to set up a DB and insert some data. I have followed some tutorials but my app gets stuck when I use getWritableDatabase() or getReadableDatabase(). Below is the code for my DBHelper I…
Ela Buwa
  • 1,652
  • 3
  • 22
  • 43
2
votes
1 answer

Android database error (android.database.sqlite.SQLiteCantOpenDatabaseException: unable to open database file)

I am trying to open file from the pre-build database. The database is around 40-50 MB. I already write the code to copy the database from the asset into the external file. But the database cannot be load. My Database class package…
czh
  • 23
  • 1
  • 5
2
votes
3 answers

SQLiteOpenHelper: onCreate() method not called on physical device

I have done many tests on an android emulator running in version 4.4. On my app I create a sqlite database with one table using SQLiteOpenHelper: package com.findwords.modeles; import android.content.Context; import…
Chewbye
  • 263
  • 1
  • 8
  • 20
2
votes
3 answers

Android App SQLite Database Creation Crashing

I am working on a simple app for myself that posts information to a database. I'm really new at this and tried to follow some tutorials along with other tidbits to assemble this. There is a home screen that gets to the second screen which has a…
Clam
  • 935
  • 1
  • 12
  • 24