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

Android Room Database: Difference between OnConflictStrategy.ABORT vs IGNORE

What is the difference between OnConflictStrategy.ABORT and OnConflictStrategy.IGNORE in Room Database? ABORT: roll back the transaction on conflict IGNORE: keep the existing rows I know both of them won't add a new row when there is an existed…
AliSh
  • 10,085
  • 5
  • 44
  • 76
9
votes
3 answers

How to install most recent version of Sqlite aar when using Room On Android

Im investigating Android Room databases in my current application. I am trying to install the most recent version of Sqlite by employing the most recent aar I have tried placing the aar in my database module libs folder and referencing that in my…
Hector
  • 4,016
  • 21
  • 112
  • 211
9
votes
2 answers

Backup SQLite Database in Android

I need to make an offline backup of the SQLite database in the mobile's internal storage or the SD Card. But I am clueless, how's this possible. I followed many threads here on SO, but they suggest copying the DB one location to other, which is not…
Mohammedsalim Shivani
  • 1,793
  • 3
  • 19
  • 30
9
votes
5 answers

net.sqlcipher.database.SQLiteException: file is not a database: , while compiling: select count(*) from sqlite_master

Error this line : mDataBase = SQLiteDatabase.openDatabase(dbPath, "123", null, SQLiteDatabase.NO_LOCALIZED_COLLATORS); When open the database . but whats Wrong? how to open database with password? Can any one help me? I set the password on…
9
votes
0 answers

Where is database stored - Cordova-sqlite-storage

Please don't mark this duplicate. I searched a lot and have gone through number of posts before posting this. I am working on Cordova. I have an android 5.1.1 device on which I am testing the app. I opened a database by using following code - var…
KutePHP
  • 2,206
  • 6
  • 36
  • 54
9
votes
4 answers

Not able to open database in read/write mode

I am getting below error: not an error (code 0): Could not open the database in read/write mode. I have added
9
votes
3 answers

(Android) Find path /Android in internal storage

Is there a method in Android that returns the data path on internal storage? I have 2 Android smartphone (Samsung s2 and s7 edge) where i installed an application. I want to take a sqliteDB situated in this…
Federico
  • 143
  • 1
  • 1
  • 10
9
votes
1 answer

Invalid column deleted while trying to query a column

I am trying to execute the following query in my android app: private static final String[] PROJECTION = { Data.CONTACT_ID, Data.MIMETYPE, Data.DISPLAY_NAME, Phone.NUMBER, …
somesh
  • 2,509
  • 3
  • 16
  • 24
9
votes
5 answers

Storing audio file in a database

I'm developing an application. I need to use at least 400 audio files which can be played for some respective texts. My question is which is the best and optimized way to do this? One solution is putting all the audio files in the resources folder…
Vinayak Bevinakatti
  • 40,205
  • 25
  • 108
  • 139
9
votes
1 answer

SQLite data to a RecyclerView

The app has data in a SQLite database. The UI is primarily a RecyclerView. The question is how to best to transfer data from the database into the UI, whilst keeping off the main thread? I originally planned to use a CursorLoader, ContentProvider,…
9
votes
5 answers

Read sqlite data when a transaction is running (Android)

I need to read some data from a database meanwhile I'm loading some data in another thread with a transaction. All my threads to read other tables are stopped until the transaction in other thread is finished. I need to be able to read info from the…
culebrins
  • 428
  • 9
  • 21
9
votes
1 answer

Using Green DAO with content provider

I am planning to use GreenDAO in my project. I had already tested it by creating a test project. However, I have couple of requirements, which I need to fulfill. Database of my app will be encrypted. To do so, we are planning to use SQLCipher. I…
Nitish
  • 3,097
  • 13
  • 45
  • 80
9
votes
3 answers

Android: Search Contact based on Phone Number

I have to search a contact based on the phone number. Here is the code that works to fetch contacts. Android API level which I am using is 15 String[] projection = new String[] { ContactsContract.CommonDataKinds.Phone._ID, …
9
votes
1 answer

Ormlite SQLiteCursor: close cursor on null twice or more

I have class Coach which has Collection of ScheduleEntity objects; public class Coach{ @ForeignCollectionField(columnName = FIELD_SCHEDULE_ENTITY) private Collection scheduleEntities; } [...] public class ScheduleEntity { …
Than
  • 2,759
  • 1
  • 20
  • 41
9
votes
3 answers

Does resource id changes everytime an application starts

I am storing my images in drawable and their resource id in SQLite database.My database is created when the application starts for the first time. Is it good to save the image ids in database or does the id's change every time an application…
Anirudh Sharma
  • 7,968
  • 13
  • 40
  • 42