当活动被带到面前如何获得新的额外的意向? [英] How to get new Intent extra when activity is brought to front?

查看:168
本文介绍了当活动被带到面前如何获得新的额外的意向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用的PendingIntent启动一项活动,该活动是在后台已经激活,我无法获得新的意图的临时演员。
getIntent回报启动该活动的意图但在这种情况下,Android将只是把它带回前,调用onResume。
我希望能够以更新活动得到新的附加功能。

When using a pendingIntent to start an activity and the activity is already active in the background, I can't get the new intent's extras. getIntent returns the intent that started the activity but in this case, Android will just bring it back to front and call onResume. I want to be able to get new Extras in order to update the activity.

我该怎么办呢?

推荐答案

尝试

 @Override
protected void onNewIntent(Intent intent) {
    // TODO Auto-generated method stub
    super.onNewIntent(intent);
}

编辑:设置活动launchmode到singleTask作品时

Works when setting the activity launchmode to singleTask

这篇关于当活动被带到面前如何获得新的额外的意向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆