我已经创建了通知对象NotificationCompat.Builder
,然后在我想更新的服务中的其他地方value
。这样做的正确方法是什么?我应该取消这个对象并建立另一个吗?
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendIntent = PendingIntent.getActivity(this, 0, intent, 0);
Notification noti = new NotificationCompat.Builder(this)
.setContentTitle("App")
.setContentText("estimated value:" + String.valueOf(value)) // <---- wanna update this
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pendIntent)
.build();
startForeground(1235, noti);