Search code examples
androidandroid-recents

Exclude only one activity from stack of recents


I've the following problem: When I exclude from stack of recents through AndroidManifest.xml in only one activity, all my activities are excluded from recents.

How can I exclude from the stack of recents only one of these activities?


Solution

  • If you want to "remove" (exclude) the Activity from the recents stack —I think is what you want— you can add android:excludeFromRecents="true" into the Activity definition (AndroidManifest.xml) as follow:

    <activity
      android:name=".ActivityWithoutRecents"
      android:label="@string/WithoutRecents"
      android:excludeFromRecents="true"/>
    

    For me is the easiest way to do that (and the cleanest). This should work, hiding from the pile of recents the specified activity.