Hi In my app I add a menuitem on the action bar called "add to favorite" shown by white star icon. When user click it this icon become disappear and other yellow star icon item visibility comes up...this works fine..but the problem is that when I switch to another activity or when I restart my app the previous event has been lost. How can I save this through sharedpreferences? ?.. Here my code.
On prepareoptionmenu (Menu menu){
If (ffavClicked){
menu.finditem (R.id.id_favorite).setvisible (false);
menu.finditem (R.id.id_favorite 2). setvisible (true);
}
else if (! favClicked){
menu.finditem ( R.id.id_favorite).setvisible (true);
menu.finditem (R.id.id_favorite 2).setvisible (false);
}
return ssuper . onprepareoptionmenu (menu);
}