public abstract class ViewDataBinding extends BaseObservable
DataBindingUtil.bind(View)
or
DataBindingUtil.inflate(LayoutInflater, int, ViewGroup, boolean)
should be used.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BINDING_TAG_PREFIX
Prefix for android:tag on Views with binding.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnRebindCallback(OnRebindCallback listener)
Add a listener to be called when reevaluating dirty fields.
|
void |
executePendingBindings()
Evaluates the pending bindings, updating any Views that have expressions bound to
modified variables.
|
static int |
getBuildSdkInt() |
android.view.View |
getRoot()
Returns the outermost View in the layout file associated with the Binding.
|
abstract boolean |
hasPendingBindings()
Returns whether the UI needs to be refresh to represent the current data.
|
abstract void |
invalidateAll()
Invalidates all binding expressions and requests a new rebind to refresh UI.
|
void |
removeOnRebindCallback(OnRebindCallback listener)
Removes a listener that was added in
addOnRebindCallback(OnRebindCallback) . |
abstract boolean |
setVariable(int variableId,
java.lang.Object value)
Set a value value in the Binding class.
|
void |
unbind()
Removes binding listeners to expression variables.
|
addOnPropertyChangedCallback, notifyChange, notifyPropertyChanged, removeOnPropertyChangedCallback
public static final java.lang.String BINDING_TAG_PREFIX
public static int getBuildSdkInt()
public abstract boolean setVariable(int variableId, java.lang.Object value)
Typically, the developer will be able to call the subclass's set method directly. For
example, if there is a variable x
in the Binding, a setX
method
will be generated. However, there are times when the specific subclass of ViewDataBinding
is unknown, so the generated method cannot be discovered without reflection. The
setVariable call allows the values of variables to be set without reflection.
variableId
- the BR id of the variable to be set. For example, if the variable is
x
, then variableId will be BR.x
.value
- The new value of the variable to be set.true
if the variable is declared or used in the binding or
false
otherwise.public void addOnRebindCallback(OnRebindCallback listener)
executePendingBindings()
.listener
- The listener to add.public void removeOnRebindCallback(OnRebindCallback listener)
addOnRebindCallback(OnRebindCallback)
.listener
- The listener to remove.public void executePendingBindings()
public abstract void invalidateAll()
public abstract boolean hasPendingBindings()
public void unbind()
public android.view.View getRoot()