You have to give an id to your layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
id="@+id/layout" >
</LinearLayout>
and then you can get it:
LinearLayout layout = (LinearLayout) findViewById(R.id.layout);
and you can now add your WebView to this layout.
solved Android take layout through code [closed]