【问题标题】:How to show/call different-different activities from status notification bar in android如何从android中的状态通知栏显示/调用不同的活动
【发布时间】:2011-05-16 19:00:47
【问题描述】:

我有一个应用程序,其中包含 3 个仪表板项目作为活动。因此,每当状态栏中有通知并单击它时,它都应该调用相应的活动。

我知道如何创建通知,但我无法在通知上调用相应的活动。还有一种方法可以根据活动来区分通知..?

帮助表示赞赏。

【问题讨论】:

    标签: android


    【解决方案1】:
    Intent notificationIntent = new Intent(context, [packagename]);
    PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
    notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
    mNotificationManager.notify(HELLO_ID, notification);   
    

    【讨论】:

    • 感谢它的帮助..但是 mNotificationManager.notify(HELLO_ID, notification); HELLO_ID 的意义是什么,或者它可以是任何常数..?
    • 是的,您可以在其中输入一个常数(可能针对每个不同的通知),并且能够在被调用的活动中读取哪个通知是调用的通知
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多