Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement dynamic values on menu item in Android [duplicate]

I have a menu item in the action bar. Along with the menu item image, I need to show some number associated with it which will change often. I am not using Action bar sherlock. I don't want to use that. Other than this everything else just works fine. In the shown image, the white icon color icon is mine. I need to generate the number with the red color background dynamically. How can I do that in Android?

Here is the sample image:

enter image description here

Update:

I have this menu item in my menu.xml. This should work like a notification menu item which shows the number of notification count. I set the menu icon like,

 menuItem.setIcon(image);

Now, on top of the menu item I need to place one text view which has the total count of notifications.

is it possible to implement this functionality with viewbadger? Github url

like image 986
intrepidkarthi Avatar asked Nov 26 '12 07:11

intrepidkarthi


1 Answers

I discovered how to add an actionView to a menu item and retrieve as set values to the view in code.

See here: https://stackoverflow.com/a/16648170/857681

like image 70
speedynomads Avatar answered Sep 18 '22 09:09

speedynomads