简体   繁体   中英

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(). 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? 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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM