Reputation: 1
Hi I'm new to Android Development, and so far learning has been going quite well, but I've hit a snag with something that is probably dead simple.
I've set up GCM with my app, it works fine. I have an icon in my android action bar that represents a notification. What I would like to do is change this icon, upon generating a notification in the app.
This is the first time I've ever asked a question on here, so please except my apologies if the question is not detailed enough or a duplicate, I've looked at other answers, but could not seem to find an exact match for what I'm trying to do.
Thanks in advance.
Upvotes: 0
Views: 72
Reputation: 6201
You can change actionbar menu item by this way. here menu is onCreateOptionsMenu(Menu menu, MenuInflater inflater)
.
menu.getItem(5 here 5 is menu number).setIcon(context.getResources().getDrawable(R.drawable.ic_action_important));
Thanks
Upvotes: 1
Reputation: 2340
Override onPrepareOptionsMenu
and call invalidateOptionsMenu
Upvotes: 0