Example usage for android.content Intent FLAG_ACTIVITY_RETAIN_IN_RECENTS

List of usage examples for android.content Intent FLAG_ACTIVITY_RETAIN_IN_RECENTS

Introduction

In this page you can find the example usage for android.content Intent FLAG_ACTIVITY_RETAIN_IN_RECENTS.

Prototype

int FLAG_ACTIVITY_RETAIN_IN_RECENTS

To view the source code for android.content Intent FLAG_ACTIVITY_RETAIN_IN_RECENTS.

Click Source Link

Document

By default a document created by #FLAG_ACTIVITY_NEW_DOCUMENT will have its entry in recent tasks removed when the user closes it (with back or however else it may finish()).

Usage

From source file:com.amaze.filemanager.utils.files.FileUtils.java

private static void applyNewDocFlag(Intent i) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        i.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
    } else {// w  w  w.j  a v a2s  .  c o  m

        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK
                | Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_RETAIN_IN_RECENTS);
    }
}