我创建了一个简单的提醒应用程序,将数据写入数据库(SQLite)。
如何提取通知标题?
在 .setContentText中写什么?
Class ReminderService:
@Override
void doReminderWork(Intent intent) {
Long rowId = intent.getExtras().getLong(DbAdapter.KEY_ROWID);
NotificationManager mgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Intent notificationIntent = new Intent(this, ReminderEditActivity.class);
notificationIntent.putExtra(DbAdapter.KEY_ROWID, rowId);
PendingIntent pi = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_ONE_SHOT);
Notification.Builder builder = new Notification.Builder(this)
.setSmallIcon(android.R.drawable.stat_sys_warning)
.setContentTitle("Title")
**.setContentText(???????????????????)**
.setContentIntent(pi);
Notification note = builder.build();
note.defaults |= Notification.DEFAULT_ALL;
note.flags |= Notification.FLAG_AUTO_CANCEL;
int id = (int)((long)rowId);
mgr.notify(id, note);
}
}
请帮帮我!