I have an SQLite DB in my Android Project. I have a RecyclerView for “Cart” Activity, where I display some items from this DB. Every item has its own “quantity” and “price”. What I want to do, is to create a method to display a total sum of elements (Total price = Elem1(quantity * price) + Elem2(quantity * price)+…) in
Tag: 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 spinner object in
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. How would I go about
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 query with this WHERE clause:
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’m
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 give the name (alias)
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 NewTaskActivity.java using Log.d() after ‘insert’ and before ‘finish’ but they got me nothing. I’ve done
How to get the BigDemical in SQLite?
I’m grabbing the data of the database. If integer I can use getInt, If String I can use getString. But BigDecimal I don’t know what to use… Please Help. Thanks in advance! Answer Use BigDecimal.valueOf(double val):
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 me the code when