Stay organized with collections
Save and categorize content based on your preferences.
Observer
interface Observer
A class can implement the Observer
interface when it wants to be informed of changes in observable objects.
Summary
Public methods |
abstract Unit |
This method is called whenever the observed object is changed.
|
Public methods
update
abstract fun update(
o: Observable!,
arg: Any!
): Unit
Deprecated: Deprecated in Java.
This method is called whenever the observed object is changed. An application calls an Observable
object's notifyObservers
method to have all the object's observers notified of the change.
Parameters |
o |
Observable!: the observable object. |
arg |
Any!: an argument passed to the notifyObservers method. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Observer\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nObserver\n========\n\n```\ninterface Observer\n```\n\n|-------------------------|\n| [java.util.Observer](#) |\n\n*** ** * ** ***\n\n| **This interface was deprecated in API level 33.**\n|\n| This interface has been deprecated. See the [Observable](/reference/kotlin/java/util/Observable) class for further information.\n\nA class can implement the `Observer` interface when it wants to be informed of changes in observable objects.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [update](#update(java.util.Observable,%20kotlin.Any))`(`o:` `[Observable](/reference/kotlin/java/util/Observable)!`, `arg:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!`)` This method is called whenever the observed object is changed. |\n\nPublic methods\n--------------\n\n### update\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun update(\n o: Observable!, \n arg: Any!\n): Unit\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nThis method is called whenever the observed object is changed. An application calls an `Observable` object's `notifyObservers` method to have all the object's observers notified of the change.\n\n| Parameters ||\n|-------|----------------------------------------------------------------------------------------------------------------------------------|\n| `o` | [Observable](/reference/kotlin/java/util/Observable)!: the observable object. |\n| `arg` | [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)!: an argument passed to the `notifyObservers` method. |"]]