title: How to use ViewBinding with an abstract base class
body: <p>I started using ViewBinding. After searching for an example or some advice,  I ended up posting this question here.</p>
  <p>How do I use ViewBinding with an abstract base class that handles the same logic on views that are expected to be present in every child's layout?</p>
  <p><strong>Scenario:</strong><br />
  I have a base class <code>public abstract class BaseFragment</code>. There are multiple Fragments that extend this base class. These Fragments have common views that are handled from the base class implementation (with the &quot;old&quot; <code>findViewById()</code>). For example, every fragment's layout is expected to contain a TextView with ID text_title. Here's how it's handled from the <code>BaseFragment</code>'s <code>onViewCreated()</code>:</p>
  <pre><code>TextView title = view.findViewById(R.id.text_title);
  // Do something with the view from the base class
  </code></pre>
  <p>Now the ViewBinding API generates binding classes for each child Fragment. I can reference the views using the binding, but I can't use the concrete Bindings from the base class. Even if I introduced generics to the base class, there are too many types of fragment bindings So I discarded this solution for now.</p>
  <p>What's the recommended way of handling the binding's views from the abstract base class? Are there any best practices? I didn't find a built-in mechanism in the API to handle this scenario in an elegant way.</p>
  <p>When the child fragments are expected to contain common views, I could provide abstract methods that return the views from the concrete bindings of the Fragments and make them accessible from the base class. (For example <code>protected abstract TextView getTitleView();</code>). But is this an advantage rather than using <code>findViewById()</code>? Are there any other (better) solutions?</p>