Example usage for android.app Activity isInMultiWindowMode

List of usage examples for android.app Activity isInMultiWindowMode

Introduction

In this page you can find the example usage for android.app Activity isInMultiWindowMode.

Prototype

public boolean isInMultiWindowMode() 

Source Link

Document

Returns true if the activity is currently in multi-window mode.

Usage

From source file:Main.java

/**
 * This function can be used with any API level and will return
 * false if the multi window feature is not supported.
 * @param activity to get access to multi window api
 * @return true if activity is currently displayed in multi window mode
 *//*from  ww  w  . j av  a 2s.  c  o m*/
@TargetApi(24)
public static boolean isInsideMultiWindow(Activity activity) {
    return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode();
}

From source file:io.github.hidroh.materialistic.AppUtils.java

@SuppressLint("InlinedApi")
public static Intent multiWindowIntent(Activity activity, Intent intent) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && activity.isInMultiWindowMode()) {
        intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    }/*from   w w  w  .j av  a 2 s .c o m*/
    return intent;
}