public class DataBindingUtil
extends java.lang.Object
ViewDataBinding from layouts.| Modifier and Type | Method and Description | 
|---|---|
| static <T extends ViewDataBinding>  | bind(android.view.View root)Returns the binding for the given layout root or creates a binding if one
 does not exist. | 
| static <T extends ViewDataBinding>  | bind(android.view.View root,
    DataBindingComponent bindingComponent)Returns the binding for the given layout root or creates a binding if one
 does not exist. | 
| static java.lang.String | convertBrIdToString(int id)Converts the given BR id to its string representation which might be useful for logging
 purposes. | 
| static <T extends ViewDataBinding>  | findBinding(android.view.View view)Retrieves the binding responsible for the given View. | 
| static <T extends ViewDataBinding>  | getBinding(android.view.View view)Retrieves the binding responsible for the given View layout root. | 
| static DataBindingComponent | getDefaultComponent()Returns the default  DataBindingComponentused in data binding. | 
| static <T extends ViewDataBinding>  | inflate(android.view.LayoutInflater inflater,
       int layoutId,
       android.view.ViewGroup parent,
       boolean attachToParent)Inflates a binding layout and returns the newly-created binding for that layout. | 
| static <T extends ViewDataBinding>  | inflate(android.view.LayoutInflater inflater,
       int layoutId,
       android.view.ViewGroup parent,
       boolean attachToParent,
       DataBindingComponent bindingComponent)Inflates a binding layout and returns the newly-created binding for that layout. | 
| static <T extends ViewDataBinding>  | setContentView(android.app.Activity activity,
              int layoutId)Set the Activity's content view to the given layout and return the associated binding. | 
| static <T extends ViewDataBinding>  | setContentView(android.app.Activity activity,
              int layoutId,
              DataBindingComponent bindingComponent)Set the Activity's content view to the given layout and return the associated binding. | 
| static void | setDefaultComponent(DataBindingComponent bindingComponent)Set the default  DataBindingComponentto use for data binding. | 
public static void setDefaultComponent(DataBindingComponent bindingComponent)
DataBindingComponent to use for data binding.
 
 bindingComponent may be passed as the first parameter of binding adapters.
 
When instance method BindingAdapters are used, the class instance for the binding adapter is retrieved from the DataBindingComponent.
public static DataBindingComponent getDefaultComponent()
DataBindingComponent used in data binding. This can be
 null if no default was set in
 setDefaultComponent(DataBindingComponent).DataBindingComponent used in data binding. This can be
 null if no default was set in
 setDefaultComponent(DataBindingComponent).public static <T extends ViewDataBinding> T inflate(android.view.LayoutInflater inflater, int layoutId, android.view.ViewGroup parent, boolean attachToParent)
setDefaultComponent(DataBindingComponent).
 
 Use this version only if layoutId is unknown in advance. Otherwise, use
 the generated Binding's inflate method to ensure type-safe inflation.
inflater - The LayoutInflater used to inflate the binding layout.layoutId - The layout resource ID of the layout to inflate.parent - Optional view to be the parent of the generated hierarchy
               (if attachToParent is true), or else simply an object that provides
               a set of LayoutParams values for root of the returned hierarchy
               (if attachToParent is false.)attachToParent - Whether the inflated hierarchy should be attached to the
                       parent parameter. If false, parent is only used to create
                       the correct subclass of LayoutParams for the root view in the XML.null if
 the layoutId wasn't for a binding layout.android.view.InflateException - When a merge layout was used and attachToParent was false.setDefaultComponent(DataBindingComponent)public static <T extends ViewDataBinding> T inflate(android.view.LayoutInflater inflater, int layoutId, android.view.ViewGroup parent, boolean attachToParent, DataBindingComponent bindingComponent)
 Use this version only if layoutId is unknown in advance. Otherwise, use
 the generated Binding's inflate method to ensure type-safe inflation.
inflater - The LayoutInflater used to inflate the binding layout.layoutId - The layout resource ID of the layout to inflate.parent - Optional view to be the parent of the generated hierarchy
               (if attachToParent is true), or else simply an object that provides
               a set of LayoutParams values for root of the returned hierarchy
               (if attachToParent is false.)attachToParent - Whether the inflated hierarchy should be attached to the
                       parent parameter. If false, parent is only used to create
                       the correct subclass of LayoutParams for the root view in the XML.bindingComponent - The DataBindingComponent to use in the binding.null if
 the layoutId wasn't for a binding layout.android.view.InflateException - When a merge layout was used and attachToParent was false.public static <T extends ViewDataBinding> T bind(android.view.View root)
setDefaultComponent(DataBindingComponent).
 
 Prefer using the generated Binding's bind method to ensure type-safe inflation
 when it is known that root has not yet been bound.
root - The root View of the inflated binding layout.java.lang.IllegalArgumentException - when root is not from an inflated binding layout.getBinding(View)public static <T extends ViewDataBinding> T bind(android.view.View root, DataBindingComponent bindingComponent)
 Prefer using the generated Binding's bind method to ensure type-safe inflation
 when it is known that root has not yet been bound.
root - The root View of the inflated binding layout.bindingComponent - The DataBindingComponent to use in data binding.java.lang.IllegalArgumentException - when root is not from an inflated binding layout.getBinding(View)public static <T extends ViewDataBinding> T findBinding(android.view.View view)
view is not a
 binding layout root, its parents will be searched for the binding. If there is no binding,
 null will be returned.
 
 This differs from getBinding(View) in that findBinding takes any view in the
 layout and searches for the binding associated with the root. getBinding
 takes only the root view.
view - A View in the bound layout.null if
 view is not part of a bound layout.public static <T extends ViewDataBinding> T getBinding(android.view.View view)
null will be returned. This uses the DataBindingComponent set in
 setDefaultComponent(DataBindingComponent).view - The root View in the layout with binding.null if
 either the view is not a root View for a layout or view hasn't been bound.public static <T extends ViewDataBinding> T setContentView(android.app.Activity activity, int layoutId)
activity - The Activity whose content View should change.layoutId - The resource ID of the layout to be inflated, bound, and set as the
                 Activity's content.public static <T extends ViewDataBinding> T setContentView(android.app.Activity activity, int layoutId, DataBindingComponent bindingComponent)
bindingComponent - The DataBindingComponent to use in data binding.activity - The Activity whose content View should change.layoutId - The resource ID of the layout to be inflated, bound, and set as the
                 Activity's content.public static java.lang.String convertBrIdToString(int id)
id - The integer id, which should be a field from BR class.