public class ObservableByte extends BaseObservable implements Parcelable, Serializable
Observable field classes may be used instead of creating an Observable object:
public class MyDataObject {
public final ObservableByte flags = new ObservableByte();
}
Fields of this type should be declared final because bindings only detect changes in the
field's value, not of the field itself.
This class is parcelable and serializable but callbacks are ignored when the object is parcelled / serialized. Unless you add custom callbacks, this will not be an issue because data binding framework always re-registers callbacks when the view is bound.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Observable.OnPropertyChangedCallback
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<ObservableByte> |
CREATOR |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
ObservableByte()
Creates an ObservableByte with the initial value of
0 . |
ObservableByte(byte value)
Creates an ObservableByte with the given initial value.
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
byte |
get() |
void |
set(byte value)
Set the stored value.
|
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
addOnPropertyChangedCallback, notifyChange, notifyPropertyChanged, removeOnPropertyChangedCallback
public static final Parcelable.Creator<ObservableByte> CREATOR
public ObservableByte(byte value)
value
- the initial value for the ObservableBytepublic ObservableByte()
0
.public byte get()
public void set(byte value)
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.