Example usage for android.app ActivityManager MOVE_TASK_NO_USER_ACTION

List of usage examples for android.app ActivityManager MOVE_TASK_NO_USER_ACTION

Introduction

In this page you can find the example usage for android.app ActivityManager MOVE_TASK_NO_USER_ACTION.

Prototype

int MOVE_TASK_NO_USER_ACTION

To view the source code for android.app ActivityManager MOVE_TASK_NO_USER_ACTION.

Click Source Link

Document

Flag for #moveTaskToFront(int,int) : don't count this as a user-instigated action, so the current activity will not receive a hint that the user is leaving.

Usage

From source file:uk.org.ngo.squeezer.framework.BaseActivity.java

@Override
@TargetApi(Build.VERSION_CODES.KITKAT)/*  ww w .j  a va 2  s .  c o m*/
public void finish() {
    super.finish();
    if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT && !isTaskRoot() && mIsRestoredToTop) {
        // 4.4.2 platform issues for FLAG_ACTIVITY_REORDER_TO_FRONT,
        // reordered activity back press will go to home unexpectedly,
        // Workaround: move reordered activity current task to front when it's finished.
        ActivityManager tasksManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
        tasksManager.moveTaskToFront(getTaskId(), ActivityManager.MOVE_TASK_NO_USER_ACTION);
    }
}