我有setLatestEventInfo问题,我无法将其更改为新版本。 请帮我重写新的代码。已弃用notification.setLatestEventInfo
private void showNotification(int moodId, int textId) {
CharSequence text = getText(textId);
Notification notification = new Notification(R.drawable.icon, getText(R.string.notify_message_started), System.currentTimeMillis());
notification.setLatestEventInfo(this, getText(R.string.notify_message_running_headline), getText(R.string.notify_message_running_text),
PendingIntent.getActivity(this, 0, new Intent(this, AudioMonitor.class).setFlags(603979776), 0));
notification.flags |= 2;
this.mNM.notify(MOOD_NOTIFICATIONS, notification);
}
我想可以使用标志为此行“notification.flags | = 2”在新的级别api。 我是新的android初学者
使用[NotificationCompat.Builder](https://developer.android.com/reference/android /app/Notification.Builder.html)而不是 – ADM
[如何使用NotificationCompat.Builder创建通知?](https://stackoverflow.com/questions/13902115/how-to-create-a-notification-with -notificationcompat-builder) –
@TadijaBagarić我想在通知中使用标志。这个链接dos'nt有这个项目 – zahra