android.view
public
abstract
class
android.view.OrientationListener
Helper class for receiving notifications from the SensorManager when
the orientation of the device has changed.
Summary
Constants
|
|
|
Value |
|
int |
ORIENTATION_UNKNOWN |
Returned from onOrientationChanged when the device orientation cannot be determined
(typically when the device is in a close to flat position). |
-1 |
0xffffffff |
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Constants
public
static
final
int
ORIENTATION_UNKNOWN
Returned from onOrientationChanged when the device orientation cannot be determined
(typically when the device is in a close to flat position).
Constant Value:
-1
(0xffffffff)
Public Constructors
public
OrientationListener(Context context)
Creates a new OrientationListener.
Parameters
context
| for the OrientationListener.
|
Public Methods
public
void
disable()
Disables the OrientationListener.
public
void
enable()
Enables the OrientationListener so it will monitor the sensor and call
onOrientationChanged(int) when the device orientation changes.
public
abstract
void
onOrientationChanged(int orientation)
Called when the orientation of the device has changed.
orientation parameter is in degrees, ranging from 0 to 359.
orientation is 0 degrees when the device is oriented in its natural position,
90 degrees when its left side is at the top, 180 degrees when it is upside down,
and 270 degrees when its right side is to the top.
ORIENTATION_UNKNOWN is returned when the device is close to flat
and the orientation cannot be determined.
Parameters
orientation
| The new orientation of the device. |
public
void
onSensorChanged(int sensor, float[] values)
Called when sensor values have changed.
The length and contents of the values array vary
depending on which sensor is being monitored.
See
SensorManager
for details on possible sensor types and values.