Android:从后台运行活动

Android:从后台运行活动,android,Android,我有一些活动,在活动A中,我在新任务中开始新的活动B,所以A进入it任务的背景。在B中,我开始C,从C开始A…我需要回到第一个任务。怎么做?谢谢 将意图与意图标志一起使用 Intent intent= new Intent(CurrentActivity.this, DestinationActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); 这应该用于启动新的活动,例如在您的案例中的B和C 及 可用于在您的情况下重

我有一些活动,在活动A中,我在新任务中开始新的活动B,所以A进入it任务的背景。在B中,我开始C,从C开始A…我需要回到第一个任务。怎么做?谢谢

将意图与意图标志一起使用

Intent intent= new Intent(CurrentActivity.this, DestinationActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));
这应该用于启动新的活动,例如在您的案例中的B和C


可用于在您的情况下重新启动。希望这有帮助。

为什么不使用服务?)或异步任务?我不明白为什么要将活动放在后台?我只在新任务中使用服务..服务启动活动。。
Intent intent= new Intent(CurrentActivity.this, DestinationActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT));