我有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