Asset
Stay organized with collections
Save and categorize content based on your preferences.
An Asset
is a binary
blob shared between data items that is replicated across the wearable network on demand.
It may represent an Asset
not yet
added with the Android Wear network. A DataItemAsset
represents an Asset
after it has
been added to the network through a PutDataRequest
.
Inherited Constant Summary
From interface android.os.Parcelable
int |
CONTENTS_FILE_DESCRIPTOR |
|
int |
PARCELABLE_WRITE_RETURN_VALUE |
|
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
From interface android.os.Parcelable
abstract int |
describeContents()
|
abstract void |
writeToParcel( Parcel arg0,
int arg1)
|
Public Methods
public static Asset
createFromBytes (byte[]
assetData)
Creates an Asset
using
a byte array.
Creates an Asset
using
a file descriptor. The FD should be closed after being successfully sent in a
DataClient.putDataItem(PutDataRequest)
request.
The Wearable API will copy the file descriptor's data in the caller's process as
soon as the corresponding PutDataRequest
is provided to the API.
public static Asset
createFromUri (Uri uri)
public boolean equals (Object o)
public String getDigest ()
Returns the digest associated with the Asset
data.
A digest is a content identifier used to identify the Asset
across
devices.
Returns
- the
Asset
's
digest, or null
if the digest is unset
Returns the file descriptor referencing the Asset
.
public Uri getUri ()
Returns the uri referencing the Asset
data.
public void writeToParcel (Parcel dest, int
flags)
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-10-31 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-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eAsset\u003c/code\u003e objects represent binary blobs shared between data items in the Android Wear network, replicating on demand.\u003c/p\u003e\n"],["\u003cp\u003eYou can create \u003ccode\u003eAsset\u003c/code\u003e objects from various sources like byte arrays, file descriptors, existing digests, or content URIs.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAsset\u003c/code\u003e provides methods to access its data via digest, file descriptor, or URI.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eDataItemAsset\u003c/code\u003e represents an \u003ccode\u003eAsset\u003c/code\u003e that's been added to the network through a \u003ccode\u003ePutDataRequest\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe Wearable API copies the file descriptor's data when the \u003ccode\u003ePutDataRequest\u003c/code\u003e is provided, so you should close the FD afterwards.\u003c/p\u003e\n"]]],["The `Asset` class represents a binary blob shared across the wearable network. Key actions include creating assets from byte arrays (`createFromBytes`), file descriptors (`createFromFd`), existing asset digests (`createFromRef`), or content URIs (`createFromUri`). Assets can be identified by their digest (`getDigest`), accessed via file descriptor (`getFd`), or URI (`getUri`). The class also provides methods for equality checks (`equals`), hashing (`hashCode`), and parceling (`writeToParcel`).\n"],null,[]]