I have a list with items that when clicked open a new activity (recipe activity from now on) which shows an image, 2 text views and a check box.
the list is populated by an xml file with string-arrays.
depending on what was clicked the recipe activity shows info which is drawn from another xml file. Something like this:
1.(in list)
(String product = ((TextView) view).getText().toString();)
2.(in recipe activity)
if(product.equals(“Naan”))
sastojci = getString(R.string.sNaan);
Anyway, the problem is following:
i want a check box which can read the product variable, check if it was selected before and put in favorites (shared preferences) then depending on if is in favorites or not to show its correct state (checked or unchecked).
because right now i have a check box that is the same for any item on the list i select…if i select the first item it will stay checked on all items,same for unchecked…
how can something like this be done?
Ok, i think i got it…
First save the state of
CheckBoxfor selected string:Now, load the settings by
Here, the check state for each string is stored separately.