0

I have a list with corresponding checkboxes, I would like to save the state of them so I can load the list of checked item when the app runs. How would I do this?

My onRetain looks like:

public Object onRetainNonConfigurationInstance() {
    return planets;
}

With planets being the entire list.

I have read up on SharedPreferences but I can't seem to get it working :(

J. Steen
  • 15,470
  • 15
  • 56
  • 63
fasheikh
  • 419
  • 3
  • 19

2 Answers2

1

database::: Table name : state_checkBox

Fields position : int state : boolean

for code refer this links..

  1. Video

  2. example Code

you just have to update the state as "true" or "false" in the database but in getview all time you have to call a query to setChecked() the checkbox

& you hav to update the database on the checkedchangedlistner() of the checkbox...

SilentKiller
  • 6,944
  • 6
  • 40
  • 75
0

if you want to store in persistence you should use D.B. like this

if you want only for the session you should use bundle, here in example

Community
  • 1
  • 1
Tomer Mor
  • 7,998
  • 5
  • 29
  • 43
  • how can I save the list to the database? I have already saved the list to the database but it doesn't save as the checkboxes don't stay checked – fasheikh Aug 14 '12 at 09:49