简体   繁体   中英

how to manage a list in SQLite android?

For my app, I have created an SQLite database, login activity, signup activity and all of them are working fine. I also have a string value with a specific date. When signed up for the first time the value and date get stored in the database, But while signing in I want to add another value to the same string and it's date without creating a new column or replacing the previous value. if I use the updateEntry.database it would replace the previous value.

In short, what I want to achieve is a list of the string with a change in value and date. and then populate a listview on profile activity with it.

The string value is unique for every username, so it must be added to its particular username. I have tried initializing a method which created a list of the strings with different values but it mixed the values of all the usernames.

" In short, what I want to achieve is a list of the string with a change in value and date "

When you signup for the first time, save the JSONObject (or whatever) response as one of the columns on SQLite table, and for subsequent logins get the response and append the current response with existing one and save it.

" The string value is unique for every username, so it must be added to its particular username. I have tried initializing a method which created a list of the strings with different values but it mixed the values of all the usernames "

Parse the response from SQLite applying where condition (like username="someusername" ) and create the list, it will give you the list for that particular user.

Hope it helps

you can do it two way

using JSONObject and using get,append and replace in sqlite manually

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM