[英]Returning to an activity (but not through finish())
as the title states, how do I return to an activity that has been started but not by calling finish(). 如标题所述,如何返回已启动但未通过调用finish()的活动。 I'm primarily concerned about this because I don't know how to tell a Notification to return to the original activity that created it when a user pulls down their notification bar and clicks on the notification. 我主要关注这个问题,因为当用户下拉通知栏并点击通知时,我不知道如何告知通知返回创建它的原始活动。 The tutorial on how to create a notification only explains how to launch a new activity after it is clicked on. 有关如何创建通知的教程仅说明了如何在单击后启动新活动。
Is there some kind of Intent call that can do this? 是否有某种Intent调用可以做到这一点? Thanks in advance! 提前致谢!
Use getIntent(), instead of creating a new Intent. 使用getIntent(),而不是创建新的Intent。
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, getIntent(), 0);
.....
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.