Skip to content
Advertisement

Tag: android-sqlite

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

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

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

Advertisement