DataEvent
Stay organized with collections
Save and categorize content based on your preferences.
Data interface for data events.
Public Method Summary
abstract DataItem
|
getDataItem
() Returns the data item modified in this event.
|
abstract int |
getType
() Returns the type of event this is.
|
Inherited Method Summary
From interface
com.google.android.gms.common.data.Freezable
Constants
public static final int
TYPE_CHANGED
Indicates that the enclosing DataEvent
was triggered by a data item being added or changed.
Constant Value:
1
public static final int
TYPE_DELETED
Indicates that the enclosing DataEvent
was triggered by a data item being deleted.
Constant Value:
2
Public Methods
public abstract DataItem
getDataItem
()
Returns the data item modified in this event. An event of TYPE_DELETED
will only have its URI
populated.
public abstract int
getType
()
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-21 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 2024-11-21 UTC."],[[["\u003cp\u003e\u003ccode\u003eDataEvent\u003c/code\u003e is an interface providing data for events triggered by changes to data items.\u003c/p\u003e\n"],["\u003cp\u003eIt has two event types: \u003ccode\u003eTYPE_CHANGED\u003c/code\u003e for additions or modifications, and \u003ccode\u003eTYPE_DELETED\u003c/code\u003e for deletions of data items.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDataEvent\u003c/code\u003e allows you to access the modified or deleted \u003ccode\u003eDataItem\u003c/code\u003e and determine the type of event that occurred.\u003c/p\u003e\n"],["\u003cp\u003eIt inherits methods from \u003ccode\u003eFreezable\u003c/code\u003e for data management.\u003c/p\u003e\n"]]],["`DataEvent` is an interface for data events, triggered by data item changes. Key actions include retrieving the modified data item via `getDataItem()` and determining the event type with `getType()`. Event types are `TYPE_CHANGED` (data added or modified) and `TYPE_DELETED` (data removed). `getDataItem` returns a `DataItem`; for deletions, only the URI is provided. Inherited methods allow freezing the `DataEvent` and checking if its data is valid.\n"],null,["# DataEvent\n\npublic interface **DataEvent** implements [Freezable](/android/reference/com/google/android/gms/common/data/Freezable)\\\u003c[DataEvent](/android/reference/com/google/android/gms/wearable/DataEvent)\\\u003e \nData interface for data events. \n\n### Constant Summary\n\n|-----|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| int | [TYPE_CHANGED](/android/reference/com/google/android/gms/wearable/DataEvent#TYPE_CHANGED) | Indicates that the enclosing [DataEvent](/android/reference/com/google/android/gms/wearable/DataEvent) was triggered by a data item being added or changed. |\n| int | [TYPE_DELETED](/android/reference/com/google/android/gms/wearable/DataEvent#TYPE_DELETED) | Indicates that the enclosing [DataEvent](/android/reference/com/google/android/gms/wearable/DataEvent) was triggered by a data item being deleted. |\n\n### Public Method Summary\n\n|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [DataItem](/android/reference/com/google/android/gms/wearable/DataItem) | [getDataItem](/android/reference/com/google/android/gms/wearable/DataEvent#getDataItem())() Returns the data item modified in this event. |\n| abstract int | [getType](/android/reference/com/google/android/gms/wearable/DataEvent#getType())() Returns the type of event this is. |\n\n### Inherited Method Summary\n\nFrom interface com.google.android.gms.common.data.Freezable \n\n|------------------------------------------------------------------------------------|---------------|\n| abstract [DataEvent](/android/reference/com/google/android/gms/wearable/DataEvent) | freeze() |\n| abstract boolean | isDataValid() |\n\nConstants\n---------\n\n#### public static final int\n**TYPE_CHANGED**\n\nIndicates that the enclosing [DataEvent](/android/reference/com/google/android/gms/wearable/DataEvent)\nwas triggered by a data item being added or changed. \nConstant Value: 1 \n\n#### public static final int\n**TYPE_DELETED**\n\nIndicates that the enclosing [DataEvent](/android/reference/com/google/android/gms/wearable/DataEvent)\nwas triggered by a data item being deleted. \nConstant Value: 2\n\nPublic Methods\n--------------\n\n#### public abstract [DataItem](/android/reference/com/google/android/gms/wearable/DataItem)\n**getDataItem** ()\n\nReturns the data item modified in this event. An event of [TYPE_DELETED](/android/reference/com/google/android/gms/wearable/DataEvent#TYPE_DELETED)\nwill only have its [URI](/android/reference/com/google/android/gms/wearable/DataItem#getUri())\npopulated. \n\n#### public abstract int **getType** ()\n\nReturns the type of event this is. One of [TYPE_CHANGED](/android/reference/com/google/android/gms/wearable/DataEvent#TYPE_CHANGED),\n[TYPE_DELETED](/android/reference/com/google/android/gms/wearable/DataEvent#TYPE_DELETED)."]]