|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.rim.device.api.system.Display
public final class Display
Provides access to the BlackBerry device’s screen properties. You can use this class to access information
such as screen size, dimensions, orientation, backlight, and subpixel support. To configure your
application to only allow specific screen properties, use the various methods available in Ui
.
NOTE: A distinction is made between screen orientation and direction. Orientation refers to the following BlackBerry device screen aspect ratios:
Display.ORIENTATION_PORTRAIT
, where the vertical resolution is larger than the horizontal resolution;
Display.ORIENTATION_LANDSCAPE
, where the horizontal resolution is larger than the vertical resolution; and
Display.ORIENTATION_SQUARE
, where both vertical and horizontal resolution are equal.
To retrieve information on current orientation, invoke Display.getOrientation()
.
Direction refers to the top of the drawing area of the screen, which is always relative to the location of the BlackBerry logo. That is:
Display.DIRECTION_NORTH
is when the top of the drawable area is the screen side closest to the BlackBerry logo;
Display.DIRECTION_WEST
is when the top of the drawable area is to the left of the logo;
Display.DIRECTION_EAST
is when the top of the drawable area is to the right of the logo; and
You can configure your application to only allow specific orientations by passing in specific direction parameters
when invoking UiEngineInstance#setAcceptableDirections
.
Field Summary | ||
---|---|---|
static int |
DIRECTION_EAST
A direction the BlackBerry device screen can support. |
|
static int |
DIRECTION_LANDSCAPE
A direction the BlackBerry device screen can support. |
|
static int |
DIRECTION_NORTH
A supported direction for the BlackBerry device screen where the top of the screen is on the same side as the "BlackBerry" logo at the top of the device . |
|
static int |
DIRECTION_PORTRAIT
A direction the BlackBerry device screen can support. |
|
static int |
DIRECTION_WEST
A direction the BlackBerry device screen can support. |
|
static int |
DISPLAY_PROPERTY_NO_SUBPIXELS
Sets the BlackBerry device screen to not support subpixels. |
|
static int |
DISPLAY_PROPERTY_REQUIRES_BACKLIGHT
Sets the BlackBerry device screen use to use the backlight. |
|
static int |
ORIENTATION_LANDSCAPE
The aspect ratio of the BlackBerry device's screen in the current direction where the vertical resolution is larger than the horizontal resolution. |
|
static int |
ORIENTATION_PORTRAIT
The aspect ratio of the BlackBerry device's screen in the current direction where the horizontal resolution is larger than the vertical resolution. |
|
static int |
ORIENTATION_SQUARE
The aspect ratio of the BlackBerry device's screen in the current direction where both the vertical and horizontal resolution are equal. |
Method Summary | ||
---|---|---|
static int |
getContrast()
Deprecated. |
|
static int |
getContrastIncrement()
Deprecated. |
|
static int |
getHeight()
Retrieves the total drawing height of the display. |
|
static int |
getHorizontalResolution()
Retrieves the display's horizontal resolution (in pixels per meter, or PPM). |
|
static int |
getNumColors()
Retrieves the number of colors that the BlackBerry device screen can display. |
|
static int |
getOrientation()
Retrieves the graphic aspect ratio of the BlackBerry device screen based on number of horizontal versus vertical pixels. |
|
static int |
getProperties()
Retrieves the display properties. |
|
static int |
getVerticalResolution()
Retrieves the display's vertical resolution (in pixels per meter, or PPM). |
|
static int |
getWidth()
Retrieves the total drawing width of the display. |
|
static boolean |
isColor()
Determines if the BlackBerry device has a color display. |
|
static boolean |
isContrastConfigurable()
Deprecated. |
|
static boolean |
isRowwise()
Determines if the BlackBerry device's display has Rowwise orientation. |
|
static void |
screenshot(Bitmap bitmap)
Takes a screenshot of the entire screen and saves it into a Bitmap . |
|
static void |
screenshot(Bitmap bitmap,
int x,
int y,
int width,
int height)
Takes a screenshot of a portion of the screen and saves it into a Bitmap . |
|
static void |
setContrast(int contrast)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DISPLAY_PROPERTY_NO_SUBPIXELS
public static final int DISPLAY_PROPERTY_REQUIRES_BACKLIGHT
public static final int DIRECTION_NORTH
UiEngineInstance#setAcceptableDirections
.
DIRECTION_NORTH
corresponds to the direction when the top of the screen is on the same side as the
"BlackBerry" logo at the top of the BlackBerry device.
public static final int DIRECTION_EAST
UiEngineInstance#setAcceptableDirections
.
DIRECTION_EAST
corresponds to the direction when the top of the screen is 90 degrees to the left of the
"BlackBerry" logo at the top of the BlackBerry device.
public static final int DIRECTION_WEST
UiEngineInstance#setAcceptableDirections
.
DIRECTION_WEST
corresponds to the direction when the top of the screen is 90 degrees to the right of the
"BlackBerry" logo at the top of the BlackBerry device.
public static final int DIRECTION_LANDSCAPE
UiEngineInstance#setAcceptableDirections
.
public static final int DIRECTION_PORTRAIT
UiEngineInstance#setAcceptableDirections
.
public static final int ORIENTATION_SQUARE
Display.getOrientation()
returns this value if invoked when the BlackBerry device screen resolution is the same vertically and horizontally.
public static final int ORIENTATION_LANDSCAPE
Display.getOrientation()
returns this value if invoked when the BlackBerry device screen horizontal resolution is larger than the vertical
resolution.
public static final int ORIENTATION_PORTRAIT
Display.getOrientation()
returns this value if invoked when the BlackBerry device screen vertical resolution is larger than the horizontal
resolution.
Method Detail |
---|
public static int getContrast()
Use this method to retrieve the screen's contrast setting. The returned value ranges from 0 (lightest) to 100 (darkest).
public static int getContrastIncrement()
Externally, we show display contrast as a percentage, but internally the range will vary between device types. The increment is rounded down to the nearest integer. For example, if the device range is 7, the increment would be 14.
public static int getHeight()
public static int getHorizontalResolution()
public static int getNumColors()
public static int getOrientation()
Display.ORIENTATION_LANDSCAPE
, Display.ORIENTATION_PORTRAIT
, or Display.ORIENTATION_SQUARE
.public static int getProperties()
DISPLAY_PROPERTY_*
values.public static int getVerticalResolution()
public static int getWidth()
public static boolean isColor()
true
if the BlackBerry device has a color display; false
otherwise.public static boolean isContrastConfigurable()
true
if the BlackBerry device's screen contrast can be set; false
otherwise.public static boolean isRowwise()
true
if the BlackBerry device's display has a Rowwise orientation; false
otherwise.public static void setContrast(int contrast)
contrast
- New contrast value for screen.public static void screenshot(Bitmap bitmap)
Bitmap
.
The specified Bitmap
must be the same dimensions as the screen. The value that represents
the width and height of the screen can be obtained from Display.getWidth()
and Display.getHeight()
,
respectively. The width and height of the Bitmap
must be equal to this value.
The type of the specified Bitmap
must match the screen type. The following
methods can be used to determine the screen's properties:
bitmap
- The Bitmap
into which the screenshot is saved.
ControlledAccessException
- if the calling application is forbidden from taking screenshots
by IT policy and/or application control.
IllegalArgumentException
- if any of the following conditions are true:
bitmap
is nullbitmap
are not equal to the dimensions of the screenbitmap
does not match the type of the screenDisplay.screenshot(Bitmap, int, int, int, int)
public static void screenshot(Bitmap bitmap, int x, int y, int width, int height)
Bitmap
.
The dimensions of the specified Bitmap
must be large enough to hold the specified
region; that is, the width and height of bitmap
must be at least the specified
width
and height
, respectively.
The specified region (the box represented by x
, y
,
width
, and height
) must be fully contained in the screen.
This region is copied into the specified Bitmap
starting at (0, 0).
The type of the specified Bitmap
must match the type of the screen. The following
methods can be used to determine the screen's properties:
bitmap
- The Bitmap
into which the screenshot is saved.x
- The x-coordinate of the screen that marks the top-left corner of the region to be copied.y
- The y-coordinate of the screen that marks the top-left corner of the region to be copied.width
- The width of the region of the screen to be copied.height
- The height of the region of the screen to be copied.
ControlledAccessException
- if the calling application is forbidden from taking screenshots
by IT policy and/or application control.
IllegalArgumentException
- if any of the following conditions are true:
bitmap
is null;bitmap
are not large enough to hold the specified region;bitmap
does not match the type of the screen;Display.screenshot(Bitmap)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal