84.7 Accessing the WebView from the Main Activity
As with the project in the chapter entitled “An Android RecyclerView and CardView Tutorial” we need to be able to use view binding to access a component (in this case myWebView) contained in the content_main.xml file from within the MainActivity class. To be able to access views within the content_main.xml file, we once again need to assign it an id at the point that it is included. Edit the activity_main.xml file and modify the include element so that it reads as follows:
.
.
<include
android:id="@+id/contentMain"
layout="@layout/content_main" />
.
.