和进入Intent是一样的。设置通知栏的点击打开页面就可以了。
Intent notificationIntent = new Intent(this.context,this.context.getClass());
/*add the followed two lines to resume the app same with previous statues*/
notificationIntent.setAction(Intent.ACTION_MAIN);
notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
/**/
PendingIntent contentIntent = PendingIntent.getActivity(this.context, 0, notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
mNotificationManager.notify(NOTIFICATION_SERVICE_ID,notification);
在声明Notification的跳转Intent时,需要给其添加上述红色标出的两行代码,即可使每次按Notification时回到原先正在运行的Activity上面。