Hi i want to show all the notification in a single view .. and want to update number of notification in status bar ... its updating all info but showing number always 1.. please
You have to keep track of the count. You could extend the Application class:
public class AppName extends Application {
private static int pendingNotificationsCount = 0;
@Override
public void onCreate() {
super.onCreate();
}
public static int getPendingNotificationsCount() {
return pendingNotificationsCount;
}
public static void setPendingNotificationsCount(int pendingNotifications) {
pendingNotificationsCount = pendingNotifications;
}
}
And you should modify the onReceive:
@Override
public void onReceive(Context context, Intent intent) {
...
int pendingNotificationsCount = AppName.getPendingNotificationsCount() + 1;
AppName.setPendingNotificationsCount(pendingNotificationsCount);
notification.number = pendingNotificationsCount;
...
}
And you could reset the count when the user open the notification:
AppName.setPendingNotificationsCount(0);