Example usage for android.view View getDisplay

List of usage examples for android.view View getDisplay

Introduction

In this page you can find the example usage for android.view View getDisplay.

Prototype

public Display getDisplay() 

Source Link

Document

Gets the logical display to which the view's window has been attached.

Usage

From source file:com.brotherpowers.cameraview.ViewCompat2.java

/**
 * Gets the logical display to which the view's window has been attached.
 *
 * @param view The view./*  www. j a  v  a  2  s  .c  om*/
 * @return The logical display, or null if the view is not currently attached to a window.
 */
public static Display getDisplay(@NonNull View view) {
    if (Build.VERSION.SDK_INT >= 17) {
        return view.getDisplay();
    }
    return ViewCompat.isAttachedToWindow(view)
            ? DisplayManagerCompat.getInstance(view.getContext()).getDisplay(Display.DEFAULT_DISPLAY)
            : null;
}