Stay organized with collections
Save and categorize content based on your preferences.
Observer
public
interface
Observer
This interface was deprecated
in API level 33.
This interface has been deprecated. See the Observable
class for further information.
A class can implement the Observer
interface when it
wants to be informed of changes in observable objects.
Summary
Public methods |
abstract
void
|
update(Observable o, Object arg)
This method is called whenever the observed object is changed.
|
Public methods
update
public abstract void update (Observable o,
Object arg)
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 |
Object : 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](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nDeprecated in [API level\n33](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nObserver\n========\n\n\n`\npublic\n\n\ninterface\nObserver\n`\n\n\n`\n\n\n`\n\n|--------------------|\n| java.util.Observer |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\n**This interface was deprecated\nin API level 33.** \n\nThis interface has been deprecated. See the [Observable](/reference/java/util/Observable)\nclass for further information.\n\nA class can implement the `Observer` interface when it\nwants to be informed of changes in observable objects. \n**See also:**\n\n- [Observable](/reference/java/util/Observable)\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[update](/reference/java/util/Observer#update(java.util.Observable,%20java.lang.Object))`(`[Observable](/reference/java/util/Observable)` o, `[Object](/reference/java/lang/Object)` arg) ` This method is called whenever the observed object is changed. |\n\nPublic methods\n--------------\n\n### update\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void update (Observable o, \n Object arg)\n```\n\nThis method is called whenever the observed object is changed. An\napplication calls an `Observable` object's\n`notifyObservers` method to have all the object's\nobservers notified of the change.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------|----------------------------------------------------------------------|\n| `o` | `Observable`: the observable object. \u003cbr /\u003e |\n| `arg` | `Object`: an argument passed to the `notifyObservers` method. \u003cbr /\u003e |"]]