I am trying to increment a value stored in my SQLite database by a certain value, for example by 5, each time a new entry is created. I would have to check if there were any previous entrys and then display the previous row’s value + 5, and if there were no previous row’s insert a standard value of 20. I am very much stumped on what to do because this all depends on being able to check if there are any previous rows, and I just cannot find out how to do that. Any help is appreciated!
Share
Cursor.get count()returns the number of rows that satisfy the conditions. Use it to know if there are any rows.The cursor is obtained from
SQLiteDatabase.query().I recommend you to read http://developer.android.com/guide/topics/data/data-storage.html