I saw this stack overflow post but it didn't help me understand what I had to do. I understand the concept of how I am going to increment the counter's value from my query.
But I don't understand what I should use. Should I use Notification notification; or BadgeViewer badgeViewer;? I would prefer a way where I don't have to import a library.
Make a layout resource for your tabs. It should include something that represents your "badge" (a simple
TextViewwill work if you just want to show a number). When you create the tabs, specify this custom layout.Note that for
setText()to work properly, your layout needs aTextViewwithandroid:id="@android:id/text1"(this is not the badge text, this is the tab name).When you want to update the badge for a tab, you can get the
Taband ask for its view, find the badge, and set its text.