Java 在通知android上恢复当前后台活动

Java 在通知android上恢复当前后台活动,java,android,Java,Android,我的应用程序中有多个活动。我想当通知显示在酒吧,并点击它,它将从当前在后台的活动恢复 目前,我正在使用它,但它将始终带我到主活动,即启动器活动 Intent intent =new Intent(ServiceClass.this, home.class); PendingIntent pendingIntent = PendingIntent.getActivity(GcmIntentService.this, 0, intent, 0); 使用android启动应用程序时使用的相同意向过滤

我的应用程序中有多个活动。我想当通知显示在酒吧,并点击它,它将从当前在后台的活动恢复

目前,我正在使用它,但它将始终带我到主活动,即启动器活动

Intent intent =new Intent(ServiceClass.this, home.class);
PendingIntent pendingIntent = PendingIntent.getActivity(GcmIntentService.this, 0, intent, 0);

使用android启动应用程序时使用的相同意向过滤器:

    final Intent notificationIntent = new Intent(context, YourActivity.class);
    notificationIntent.setAction(Intent.ACTION_MAIN);
    notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);

您的意思是要启动除“家庭活动”之外的其他活动,还是要恢复现有的“家庭活动”屏幕?我想从应用程序进入后台的位置恢复活动。是家庭活动还是其他活动请参阅此链接:我的主要活动是splashActivity,它让我参加了此活动,而不是从当前活动中恢复