首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >单击通知,然后转到下一个详细信息页面,其中还提供了详细信息

单击通知,然后转到下一个详细信息页面,其中还提供了详细信息
EN

Stack Overflow用户
提问于 2015-05-06 14:47:54
回答 3查看 98关注 0票数 0

我是上学期计算机科学专业的学生。我有问题:我设置我的安卓应用程序接收通知,从在线数据库的求职网络application.When发生新的条目,然后通知来这里的安卓应用程序。因此,现在我希望,如果我单击该通知,将打开一个页面,其中将显示该作业的详细信息。

所以请告诉我,我只有几天的时间来提交我的最后一年的项目。我会非常感谢的。

EN

回答 3

Stack Overflow用户

发布于 2015-05-06 14:58:15

看一看Android Developers Guide。在那里,他们描述了如何设置一个PendingIntent来对点击通知做出反应。

代码语言:javascript
复制
PendingIntent resultPendingIntent;
...
mBuilder.setContentIntent(resultPendingIntent); // Code comes directly from this Developer Guide
票数 0
EN

Stack Overflow用户

发布于 2015-05-06 15:00:09

单击通知时,您必须使用待定意图才能打开页面。

代码语言:javascript
复制
// prepare intent which is triggered if the
// notification is selected

Intent intent = new Intent(this, YourActivityToBeOpen.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, 0);

您可以在here上找到更多详细信息。

票数 0
EN

Stack Overflow用户

发布于 2015-05-06 15:03:45

要创建通知:

代码语言:javascript
复制
NotificationManager mgr = (NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);
Notification note = new Notification(R.drawable.stat_notify_chat,
    "Android Example Status message!",
    System.currentTimeMillis());

// This pending intent will open after notification click
Intent i = new Intent(this, NotifyMessage.class);
PendingIntent i = PendingIntent.getActivity(this, 0, i, 0);

note.setLatestEventInfo(this, "Android Example Notification Title",
    "This is the android example notification message", i);

// After uncomment this line you will see number of notification arrived
// note.number=2;
mgr.notify(NOTIFY_ME_ID, note);

代码语言:javascript
复制
Intent i = new Intent(this, NotifyMessage.class);
PendingIntent i = PendingIntent.getActivity(this, 0, i, 0);

它会在点击通知后管理您的导航。如果您不想要导航,则使用:

代码语言:javascript
复制
Intent i = new Intent();
PendingIntent i = PendingIntent.getActivity(this, 0, i, 0);

我希望它能有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30069468

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档