I’m new to android app development and am creating an app that has Trips which stores Locations. I’m getting a compile error :”trip_Id column references a foreign key but it is not part of an index. This may trigger full table scans whenever parent table is modified so you are highly advised…
Tag: android-sqlite
Send spinner data to database
I am trying to send data to database from a spinner I initialize the database like this SPINNER + ” TYPE “; And in insert data method I put it as Type spinner but this line gives me an error contentValues.put(SPINNER, spinner); what should I put there instead of put Answer You are trying to save a…
Unable to migrate android sqllite database
I have been running the onUpgrade method without issues, until this column: I have updated the database version. The above has been simplified to try and make sure that nothing else is causing this column to not be created. Note that if I uninstall the app and reinstall the app, then it runs without issue. Ho…
Can’t find the Mistake in my Cursor initialization
And for a bigger APP project I need to work with an SQLite database. If my code works I don’t get any data back. And I think I just don’t understand the cursor object. In this code I simply want to get a firstname back but it sasy that my cursor is not initialized correctly, but I got the basic
SQLite – Problem with DateTime format when query any row comparing DateTime into WHERE clause
Let’s say i’m having a database which includes a table like this: CREATE TABLE tbl_EX (_id TEXT, TIME TEXT); And then I insert a value like this: After that, I try to query. Without WHERE clause: It retrieved me all records as expected, which are shown in 2 TextView like this: BUT, when I make que…
SQLiteConstraintException:NOT NULL constraints android
I have a an Editor Activity where i insert my data in the database. I’ve created 3 columns as :- ID INTEGER, Task TEXT NOT NULL and Days TEXT. I insert data into the Task column with data from an edit text and insert other data into the Days column by creating an alert dialog containing an edit text. I&…
SQLite: select from column by month
I am trying to sum a tablecolumn on basis of month but I got the following exception: the function the table In the debugger the cursor contains one item but when calling getInt(..) the app crashes Answer The column created for this result: is not called Total. Change the sql statement to this: This way you g…
Why don’t my data insert into SQLite database on android?
I’m creating a simple todo list. So, I have activity (NewTaskActivity) Xml code: And I have a class NewTaskActivity.java: In this class(NewTaskActivity.java) I want to add data in database. Database class (DBHelper.java): And my data don’t insert into database. Why? I checked for data in NewTaskAc…
Android Room Persistence Library : What is the best way to implement a many to many relation?
I used to use Realm and I am currently testing Room in order to compare both tools. I am trying to implement the following many to many relation : Here my Entity classes : The Person : @Entity(…
IntentService is freezing my application UI
In my application, I am using Intentservice to fetch the data from server and store fetched data in to local sqlite db. I am using 5 IntentService to fetch and fill five tables. Data may up to 300 rows for each Intent Service. What should I do? IntentService Code: Code to call intentservice: and intent send m…