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
1
vote
3 answers

android insists i don't have a column in my database table

i can't figure out this strange error while i try to insert value into database ERROR 01-01 15:48:56.065 10056-10056/com.autophone E/SQLiteLog﹕ (1) table mainTable has no column named status_date 01-01 15:48:56.100 10056-10056/com.autophone…
Iakovl
  • 1,013
  • 2
  • 13
  • 20
1
vote
1 answer

SQLiteProvider / SQLiteLog Error: No such table: products

I start using novoda/SQLiteProvider following their "simple" demo project in a fresh Android/Gradle project. It seems that I am missing some step/configuration which causes the creation of the table. That is why I end up with this…
1
vote
2 answers

Null pointer exception on SQLite insert

Ok I'm stuck at this point where I'm trying to insert data into sqlite database. It's crashing cause it is saying my db is null I think. I think I am not initializing (or maybe another term... basically to recognize what I did in the other class) in…
Clam
  • 935
  • 1
  • 12
  • 24
1
vote
3 answers

What the version mean in the abstract class SQLiteOpenHelper of Android

There is a parameter in the constructor of the virtual class SQLiteOpenHelper called version(like below shows) public SQLiteOpenHelper(Context context, String name, CursorFactory factory, int version) { this(context, name, factory, version,…
1
vote
2 answers

How to access one App's Database to another Application using Sqlite?

I have two applications which resulting to use database. Application A which creates database name DB1. This database I wanted to access in application B. The applications are in different packages. How can I do this ?
Swift
  • 829
  • 2
  • 12
  • 33
1
vote
1 answer

How to perform a lightweight migration on sqlite database in Android just the way like iOS?

I want to add some keys, such as "URL", to the existed table. In iOS, I can create a new version of data model and perform a light weight migration. However, the default way in SQLiteOpenHelper seems to destroy the old DB and create a new…
Dragon warrior
  • 1,644
  • 2
  • 24
  • 37
1
vote
3 answers

Android sqlite insert / multiple reads from many threads

I don't know how to handle this correctly without getting database locked errors. My app basically downloads many items in batches of 100 rows (~ 60.000 items) and inserts them in the database. Each batch of 100 rows is processed into a…
Alin
  • 14,809
  • 40
  • 129
  • 218
1
vote
0 answers

how to drop trigger of sqlite in Android

String sql1 = "DROP TRIGGER IF EXISTS Trigger_Insert_" + table + " ;" ; db.execSQL(sql1); String sql2 = "CREATE TRIGGER Trigger_Insert_" + table + "  AFTER INSERT "+ " ON "+ table + …
waiter.james
  • 591
  • 2
  • 6
  • 16
1
vote
1 answer

No Column named found in table sqlite

My code is correct is assume but even though it gives error coloumn not found for _pay_mode : LOGCAT : 08-20 05:22:05.398: D/Reading:(17403): Reading all contacts.. 08-20 05:22:05.539: D/income(17403): table created with price type date description…
Parth Sharma
  • 359
  • 1
  • 4
  • 21
1
vote
0 answers

Can sqlite trigger call java method in android?

Can sqlite trigger call java method in android? I create a trigger for tableA, when insert tableA, trigger will insert new data in tableB. I have to make reaction once tableB have new datas. I think polling is the worst choice. So…
waiter.james
  • 591
  • 2
  • 6
  • 16
1
vote
2 answers

Multiple threads accessing the database simultaneously

I am working on making a downloader in Android. To allow the database to be shared across multiple activities I created a singleton instance of the WritableDatabase. Each thread that downloads some content needs to write to the database how much…
An SO User
  • 24,612
  • 35
  • 133
  • 221
1
vote
4 answers

How do i delete specific rows in SQLite Database

I am new to android and i am having trouble understanding the delete function in sqlite database.I have created my database using the string private static final String TABLE_NAME="NameInfo"; private static final String POSITION_DB ="_id"; …
bourne
  • 1,083
  • 4
  • 14
  • 27
1
vote
1 answer

Efficient way to insert multiple records in sqlite database

I need to populate my sqlite database. I need to do this using multiple records insertion. As I explored, i found out that there are various ways of accomplishing this, like bulkinsert() function, ContentValues[] array etc. But I chose to go with…
divyang7
  • 309
  • 3
  • 10
  • 22
1
vote
1 answer

Inserting multiple rows at once in sqlite database

I am trying to insert multiple rows in a sqlite database. I have created a SqliteOpenHelper class and have created a database and a table. Now I need to do is to insert multiple rows in the database. Say we have five rows to insert at once, what is…
divyang7
  • 309
  • 3
  • 10
  • 22
1
vote
0 answers

Android SQLiteConstraintException: error code 19: constraint failed

I have seen some other questions about this, but none of the answers really seemed to work for my code. I'm getting a 'SQLiteConstraintException: error code 19: constraint failed' error when I try to insert into my DB. Here is the code for the…
Shakeeb Ayaz
  • 6,200
  • 6
  • 45
  • 64