I am new at android and trying to make managing members app with database. what i want to do here is that when user buys any drink it should change drinks name to “bought” in database, but when i pass Arraylist to db class it shows that my Arraylist is empty. userInputActivity here user selects drink he/she wants and when
Tag: android-sqlite
Android java : Error on SQLiteDatabase db = this.getWritableDatabase();
Am a beginner at android java. Error on SQLiteDatabase db = this.getWritableDatabase(); line in ERROR : I already had called the getWritabledatabase in the insert function. But when I try to write again. It doesn’t work. Answer You need to pass a valid Context to your SQLiteOpenHelper constructor.
Retrieving image from SQLite Database (BLOB data type)
I have tried to retrieve the byte[] from my SQLite DB using the code: Error returned: Answer Your query: returns only 1 column and since the column indices in a cursor are 0 based, you should retrieve it with: Also, you should use moveToFirst() to check if the cursor returned any rows before retrieving the column’s value:
i cant update value in SQLite
I have this table to sqlite: And this is my method to Update value: And i add a object variable in my activity: So, in activity I use this to change value using update method: But this not works because when I press the button: Class: Nothing happens because the value is (1) one all the time. What’s wrong with
Select multiple data from SQLite database based on multiple tags
I have an SQLite database with some to do lists. Each to do list, there is a column for tag. Here is a sample layout of my SQLite database Let’s say I want to select the to do lists with tags containing “Me” and “Mom” (ie “Buy groceries”, “Study” and ” Holiday trip”), how do I do this? I have
android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed Couldnot figure out what the error says
I have got stuck in the above-mentioned error message in Android Studio. My Database is a simple one 1st column: Name TEXT PRIMARY KEY 2nd column: Price TEXT I have already gone through the answers to the same question in StackOverflow but couldn’t resolve the error. I am quoting my DataBaseHelper class and insertActivity here: error: Answer These lines: assign
SharedPreferences vs SQLite Database vs Room Database, which should I use for my project and why? Pros and Cons [closed]
I have a custom ListView of Semesters, a Semester is an object, in the MainActivity of an app I’m developing to learn more about Android developing and databases. That ListView is created by the user …
Delete the first 8 rows from an SQLite database
I delete rows in a SQLite table with this: I need to delete the first 8 rows when the database has a size bigger than 8 rows, so: The method Events’s getRowCount is: But When I set the while loop in checkRowSize it delete the all database. Why this? But If I set: It just delete the first row every
Sum column SQLite Android and display on TextView
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
MVVM – get context in a Model class
I’m using MVVM to build my Android app and I need to connect the Model to a DB. Instead of Room I’m using the SQLiteOpenHelper and to make a connection to the DB I need the context. But since this is a non activity class I’m struggling to get it. My current solution looks as follows but I keep getting