How to Create a Unique Int for Each Person Added

I am working on an app right now where a person will be able to add different people to a list and then reuse those people. After they select a person, they can move on to a screen where you check a bunch of boxes such as "carrot" or "potato". Each person that is added needs to have a unique "carrot" or "potato" int so it can be used later to count up all the amount of times that carrot or potato has been checked off.

How do I go about doing the int creating whenever a new person is added? I know what to do from there but I honestly have no idea what to do about this.

So if I have a person created named "nick" I can create an int called "carrotnick". I need that id to be displayed later on without me knowing that there is a nick on the end, only the carrot part. So it can't be completely random. Still needs to be displayed later on somehow.

1 answer

  • answered 2017-11-14 23:43 Mr.AF

    Use sqlite and a table with auto incremental field so for each person which be added to table there is a unique id so you can either get ids after app restarted