开发者

Returning to an activity (but not through finish())

开发者 https://www.devze.com 2023-03-06 11:22 出处:网络
as the title states, how do I return to an activity that has been started but not by calling finish(). I\'m primarily concerned about this because I don\'t know how to tell a Notification to return to

as the title states, how do I return to an activity that has been started but not by calling 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 la开发者_JS百科unch a new activity after it is clicked on.

Is there some kind of Intent call that can do this? Thanks in advance!


Use getIntent(), instead of creating a new Intent.

PendingIntent contentIntent = PendingIntent.getActivity(context, 0,  getIntent(), 0);
.....
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
0

精彩评论

暂无评论...
验证码 换一张
取 消