按Notification 回到正在运行的activity
写好Notification , 按Home回到主界面,再按通知栏的消息(Notification), 回到退出之前正在运行的Acticity .
在代码中加入两行代码作为声名即可。 :
Intent notificationIntent = new Intent(this,this.getClass());
/* */
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, title, text, contentIntent);
mNotificationManager.notify(NOTIFICATION_SERVICE_ID,notification);