public class ObservableInt extends BaseObservable implements android.os.Parcelable, java.io.Serializable
Observable field classes may be used instead of creating an Observable object:
public class MyDataObject {
public final ObservableField name = new ObservableField();
public final ObservableInt age = new ObservableInt();
}
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.
android.os.Parcelable.ClassLoaderCreator<T>, android.os.Parcelable.Creator<T>
Observable.OnPropertyChangedCallback
Modifier and Type | Field and Description |
---|---|
static android.os.Parcelable.Creator<ObservableInt> |
CREATOR |
Constructor and Description |
---|
ObservableInt()
Creates an ObservableInt with the initial value of
0 . |
ObservableInt(int value)
Creates an ObservableInt with the given initial value.
|
Modifier and Type | Method and Description |
---|---|
int |
describeContents() |
int |
get() |
void |
set(int value)
Set the stored value.
|
void |
writeToParcel(android.os.Parcel dest,
int flags) |
addOnPropertyChangedCallback, notifyChange, notifyPropertyChanged, removeOnPropertyChangedCallback
public static final android.os.Parcelable.Creator<ObservableInt> CREATOR
public ObservableInt(int value)
value
- the initial value for the ObservableIntpublic ObservableInt()
0
.public int get()
public void set(int value)
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable