我正在尝试将 View 对象(例如 TextView、Edittext、Button 等)放入 Android 的通知中。我是这项作业的新手,我很困惑,所以这是我迄今为止的尝试。
所以我收到一条通知,如下所示:
Intent intent = new Intent(context, Receiver.class);
PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0);
Notification noti = new Notification.Builder(context)
.setContentTitle("Message From")
.setContentText("Subject").setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(pIntent)
.addAction(R.drawable.ic_launcher, "", pIntent).build();
NotificationManager notificationManager =
(NotificationManager)
context.getSystemService(context.NOTIFICATION_SERVICE);
noti.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, noti);
我知道 Jelly Bean 及之后的版本可以这样做。我想知道是否可以使用 Intent 通过 PendingIntent 插入 View 对象?
如果有人能引导我朝正确的方向前进,那就太好了
最佳答案
看这些
关于java - 将 View 对象放入通知 android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20766223/