如何在数据库的通知中注册数据?

时间:2017-10-12 15:25:43

标签: android notifications

我创建了一个简单的提醒应用程序,将数据写入数据库(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);
 }
 }

请帮帮我!

0 个答案:

没有答案