I am making custom notification, and in receiver for intents I change text in element in layout of notification itself. When I update Notification nothing happens. Intents are being passed to receiver, I checked in log. Activity that makes notification, and receiver are separate classes. Any ideas? I know for that AppWidgetProvider for widget works great, but in this case there is no AppWidgetProvider, this is plain notification. Is there any other way to invalidate RemoteView?
//Receiver.onReceive() method
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.notification_layout);
//make dataString
views.setTextViewText(R.id.n_track_name, dataString);
//while searching i figured out this is something that should update notification
NotificationManager mNotificationManager = (NotificationManager)act.getSystemService(Activity.NOTIFICATION_SERVICE);
mNotificationManager.notify(1, act.notification);
This is code which makes Notification for first time in other activity:
Notification notification = new Notification(icon, "Music Player", when);
NotificationManager mNotificationManager = (NotificationManager)MusicPlayerActivity.currentActivity.getSystemService(NOTIFICATION_SERVICE);
RemoteViews contentView = new RemoteViews(act.getPackageName(), R.layout.notification_layout);
//make pending intent on button
Intent intent = new Intent(act, NotificationReceiver.class);
intent.setAction(NotificationReceiver.ACTION_NOTIFICATION_NEXT);
PendingIntent actionPendingIntent = PendingIntent.getBroadcast(act, 0, intent, 0);
contentView.setOnClickPendingIntent(R.id.n_btnNext, actionPendingIntent);
//make other intents
//show notification
mNotificationManager.notify(1, notification);