I have a simple messaging application module. In which, there are two swipable tabs. Received and Sent. Let us say I have 20 messages out of which 10 are unread. So what I am doing is showing the tabs as Received - (10). Now when I read the message, it marks the message as read. So I would like to change the title from Received - (10) to Received - (9).
Please let me know how can I do it?
Here is the code which I am using.
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
if (position == 0) {
// if position is zero, set the title to RECEIVED.
return "Received" + " (" + String.valueOf(intUnreadReceivedMessagesCount) + ")";
} else {
// if position is 1, set the title to SENT.
return "Sent";
}
}
I am using Pager Sliding Tab Strip as a Pager Tab library. https://github.com/astuetz/PagerSlidingTabStrip
I have tried using notifyDataSetChanged() but for obvious reasons, it does not call it. Any way to resolve the issue. Any better alternative to show and update the count is also welcome.
Thank you.