dimanche 17 mai 2015

Change MenuItem icon on activity start

I am implementing a "points of interest" app and want to add a favorites list feature. I have an activity that displays the point's details as shown in the photo.

http://ift.tt/1cIjKmg

Each point object has an int that stores whether it is added in the favorites list or not (1 for added, 0 for not added).

My question is, how can I check before the activity starts, if the point is already in the favorites list and change the star icon in the action bar accordingly? I have tried in the onPrepareOptionsMenu, but as I see by debugging it is not called when the activity starts.

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire