FileDocCategorySizeDatePackage
DisplayManagerCompat.javaAPI DocAndroid 5.1 API5357Thu Mar 12 22:22:56 GMT 2015android.support.v4.hardware.display

DisplayManagerCompat

public abstract class DisplayManagerCompat extends Object
Helper for accessing features in {@link android.hardware.display.DisplayManager} introduced after API level 4 in a backwards compatible fashion.

Fields Summary
private static final WeakHashMap
sInstances
public static final String
DISPLAY_CATEGORY_PRESENTATION
Display category: Presentation displays.

This category can be used to identify secondary displays that are suitable for use as presentation displays.

Constructors Summary
DisplayManagerCompat()


     
    
Methods Summary
public abstract android.view.DisplaygetDisplay(int displayId)
Gets information about a logical display. The display metrics may be adjusted to provide compatibility for legacy applications.

param
displayId The logical display id.
return
The display object, or null if there is no valid display with the given id.

public abstract android.view.Display[]getDisplays()
Gets all currently valid logical displays.

return
An array containing all displays.

public abstract android.view.Display[]getDisplays(java.lang.String category)
Gets all currently valid logical displays of the specified category.

When there are multiple displays in a category the returned displays are sorted of preference. For example, if the requested category is {@link #DISPLAY_CATEGORY_PRESENTATION} and there are multiple presentation displays then the displays are sorted so that the first display in the returned array is the most preferred presentation display. The application may simply use the first display or allow the user to choose.

param
category The requested display category or null to return all displays.
return
An array containing all displays sorted by order of preference.
see
#DISPLAY_CATEGORY_PRESENTATION

public static android.support.v4.hardware.display.DisplayManagerCompatgetInstance(android.content.Context context)
Gets an instance of the display manager given the context.

        synchronized (sInstances) {
            DisplayManagerCompat instance = sInstances.get(context);
            if (instance == null) {
                final int version = android.os.Build.VERSION.SDK_INT;
                if (version >= 17) {
                    instance = new JellybeanMr1Impl(context);
                } else {
                    instance = new LegacyImpl(context);
                }
                sInstances.put(context, instance);
            }
            return instance;
        }