Questions tagged [android-sqlite]

Android uses SQLite to store and retrieve data persistently. Use this tag for questions regarding the Android implementation of SQLite, how to use it in your application, or for help when your implementation of SQLite doesn't work.

uses a SQLite database to store and retrieve data persistantly.

Every Android App gets a private SQLite database to persistantly store data.

See also

8244 questions
12
votes
2 answers

SQLite - Could not open database file

I am coding a Xamarin Android application, and am getting an error when trying to create a SQLite database. Here is my code: string applicationFolderPath =…
Simon
  • 7,991
  • 21
  • 83
  • 163
12
votes
4 answers

Android SQLite: attempt to re-open an already-closed object

I'm trying to get certain book data from my Inventory table based on the ISBN. However, I'm getting an error: "attempt to re-open an already-closed object". The error only occurs when I click a listView object, go to a different screen, go back to…
erad
  • 1,766
  • 2
  • 17
  • 26
12
votes
3 answers

Storage of SQLite database using Android and Phonegap

I'm developing a Android Cordova/Phonegap app where I want to use a SQLite database. I used the example from the official documentation. // Wait for device API libraries to load // document.addEventListener("deviceready", onDeviceReady, false); //…
qefzec
  • 1,360
  • 1
  • 13
  • 13
12
votes
4 answers

how to test upgrading sqlite database before uploading new version of my app on play store in android

I am getting issue no such table found "table_name" on my uploaded application after updating app version. I came out after testing I am getting this issue only after I upgrade the old version of app to new version of app What I have Implemented I…
Maulik
  • 3,316
  • 20
  • 31
12
votes
2 answers

How to implement SQLCipher when using SQLiteOpenHelper

I am trying to secure some sensible data by implementing encryption in my already existing and functioning database setup in an android application. I tried to follow this tutorial (http://sqlcipher.net/sqlcipher-for-android/) and I browsed a lot of…
JZweige
  • 721
  • 2
  • 9
  • 15
12
votes
2 answers

Android SQLite closed exception

I have no solid background of synchronization. I think this issue will be fixed when I use synchronized method. But can anyone help me to fix this issue? Code is below: public HashMap getAllRecordsInList_HashMap() { …
Mohammad Imran
  • 3,264
  • 4
  • 23
  • 37
12
votes
1 answer

GreenDAO support multiple relations between tables

I've been trying to create a DB model using GreenDAO. the problem started when I tried to create more than one relationship between a different tables. basically, I have a Message table, a Conversation table and a User table. the User has a list of…
thepoosh
  • 12,497
  • 15
  • 73
  • 132
11
votes
2 answers

Implementing Search with Room

Recently I have been messing around with Android Architecture Components (more specifically Room) but I have hit a bit of a roadblock. I have successfully built a Room database that stores a list of departments and their personnel. Previously this…
Bryan
  • 14,756
  • 10
  • 70
  • 125
11
votes
5 answers

Android room database won't export all the data

I'm trying to setup Room database backup functionality. Problem is that sql database file doesn't contain latest set of data in the app once downloaded. It always misses some most recent records. Is there a proper way to export room database?…
Tuesday Four AM
  • 1,186
  • 1
  • 11
  • 18
11
votes
3 answers

Room Migration Alter Table not adding new column & migrate getting called again and again

So basically i am using room and trying to add migration from database version 1 to 2 but my alter command is not working My current implementation is below : void init() { db = Room.databaseBuilder(Global.getInstance(), …
Gautam
  • 3,252
  • 3
  • 23
  • 32
11
votes
2 answers

How to set a default value to a TEXT column in Sqlite?

I have a simple table. I'm trying to put a default value to a TEXT column. Here is the table query: "CREATE TABLE book(_id INTEGER PRIMARY KEY AUTOINCREMENT, book_id TEXT NOT NULL DEFAULT '0', book_name TEXT NOT NULL);" It creates the table but…
Abir Hasan Shawon
  • 6,069
  • 5
  • 17
  • 28
11
votes
1 answer

Insert a time stamp into database via ContentValues

In Android, is it possible to insert a time stamp into a database using ContentValues? When I try to add it using something like this: ContentValues args = new ContentValues(); args.put(MY_DATE, my_date); I get an error telling me that…
Kevin Bradshaw
  • 6,327
  • 13
  • 55
  • 78
11
votes
2 answers

Why do we need the GLOB clause in SQLite?

I'm an Android developer and recently came across the GLOB clause in SQLite. I cannot understand why we need GLOB given that LIKE is already in place. Both clauses have wildcards to represent single and multiple characters. The only difference is…
kouretinho
  • 2,190
  • 1
  • 23
  • 37
11
votes
3 answers

ActiveAndroid Update() query

I'm trying to make a bulk update to a column using ActiveAndroid. Here's my code: new Update(SomeModel.class).set("Enabled = 0").execute(); But I'm getting a StackOverflowError. (Edit: My bad, the error was somewhere else). Does anyone know how to…
jlhonora
  • 10,179
  • 10
  • 46
  • 70
11
votes
3 answers

android.database.CursorIndexOutOfBoundsException

The data access code in my Android app raises an exception. Here is the code that causes the exception: String getPost = "SELECT * FROM " + TABLE_POST + ";"; Cursor result = getReadableDatabase().rawQuery(getPost, null); List posts = new…