I have the contacts list displayed within my app, alongside checkboxes. Everytime a checkbox is ticked, the checkbox state (boolean) gets mapped to the phone number, which I then save with SharedPreferences. Now the problem is, if the ticked contacts phone number is edited, my app crashes (because I try to retrieve the state of ticked box when I open up the contacts list within my app). Is there a better way to go around solving this issue? Am I doing the right thing by mapping the ticked checkboxes to phone number? If I had mapped the checkboxes to position of the contact in the list, it would be a mess if new contacts were added.
I also tried mapping them to _ID, but on adding or deleting a contact, the checkbox states get messed up.
Please suggest a better way to save the numbers of those selected, and retriieve the state of checkbox even if the contact is edited, or a new one added.
0 comments:
Post a Comment