0

I want to show a status bar notification which contains two texts and one progress bar of a track playing in the background to show the playback progress. This should be updated every second.

I am currently using a RemoteViews which contains a ProgressBar, and two TextViews, and I am updating them using RemoteViews.setTextViewText() and RemoteViews.setProgressBar(), then calling NotificationManager.notify() to show the updates on the notification bar. This works fine, but it gets very slow by time, I saw in the LogCat that it is producing huge amount of garbage and it seems that it is taking too long to collect it.

Any ideas on how to implement this in a better way?

Thanks

Halaseh
  • 21
  • 1

1 Answers1

2

Found the solution:

I was trying to minimize memory usage by reusing the same RemoteViews and Notification instances over and over again when I want to update the notification, but, if I create them every time the performance is much better. I know this is not the ideal solution but it works...

Halaseh
  • 21
  • 1