Added in API level 1
Deprecated in API level 3

OrientationListener


abstract class OrientationListener : SensorListener
kotlin.Any
   ↳ android.view.OrientationListener

Helper class for receiving notifications from the SensorManager when the orientation of the device has changed.

Summary

Constants
static Int

Returned from onOrientationChanged when the device orientation cannot be determined (typically when the device is in a close to flat position).

Public constructors

Creates a new OrientationListener.

OrientationListener(context: Context!, rate: Int)

Creates a new OrientationListener.

Public methods
open Unit

Disables the OrientationListener.

open Unit

Enables the OrientationListener so it will monitor the sensor and call onOrientationChanged when the device orientation changes.

open Unit
onAccuracyChanged(sensor: Int, accuracy: Int)

abstract Unit
onOrientationChanged(orientation: Int)

Look at android.view.OrientationEventListener#onOrientationChanged for method description and usage

open Unit
onSensorChanged(sensor: Int, values: FloatArray!)

Constants

ORIENTATION_UNKNOWN

Added in API level 1
static val ORIENTATION_UNKNOWN: Int

Deprecated: Deprecated in Java.

Returned from onOrientationChanged when the device orientation cannot be determined (typically when the device is in a close to flat position).

Value: -1

Public constructors

OrientationListener

Added in API level 1
OrientationListener(context: Context!)

Creates a new OrientationListener.

Parameters
context Context!: for the OrientationListener.

OrientationListener

Added in API level 3
OrientationListener(
    context: Context!,
    rate: Int)

Creates a new OrientationListener.

Parameters
context Context!: for the OrientationListener.
rate Int: at which sensor events are processed (see also SensorManager). Use the default value of SENSOR_DELAY_NORMAL for simple screen orientation change detection.

Public methods

disable

Added in API level 1
open fun disable(): Unit

Deprecated: Deprecated in Java.

Disables the OrientationListener.

enable

Added in API level 1
open fun enable(): Unit

Deprecated: Deprecated in Java.

Enables the OrientationListener so it will monitor the sensor and call onOrientationChanged when the device orientation changes.

onAccuracyChanged

Added in API level 1
open fun onAccuracyChanged(
    sensor: Int,
    accuracy: Int
): Unit

Deprecated: Deprecated in Java.

Parameters
sensor Int: The ID of the sensor being monitored
accuracy Int: The new accuracy of this sensor.

onOrientationChanged

Added in API level 1
abstract fun onOrientationChanged(orientation: Int): Unit

Deprecated: Deprecated in Java.

Look at android.view.OrientationEventListener#onOrientationChanged for method description and usage

Parameters
orientation Int: The new orientation of the device.

onSensorChanged

Added in API level 1
open fun onSensorChanged(
    sensor: Int,
    values: FloatArray!
): Unit

Deprecated: Deprecated in Java.

Parameters
sensor Int: The ID of the sensor being monitored
values FloatArray!: The new values for the sensor.