title: Getting admob and webview working together
body: <p>I've built a webview app that works fine.</p>
  
  <p>I've tried to add admob to the bottom on app, but it doesnt show.</p>
  
  <p>I've figured out if I set the main activity to </p>
  
  <pre><code> setContentView(R.layout.activity_main);
  </code></pre>
  
  <p>I get ad, but no webview</p>
  
  <p>If I set the main activity to </p>
  
  <pre><code>setContentView(mWebview );
  </code></pre>
  
  <p>I get the webview but no ad.</p>
  
  <p>How can I get both to show together?</p>
  
  <hr>
  
  <h2>mainActivity.java</h2>
  
  <pre><code>import android.app.Activity;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.view.KeyEvent;
  import android.webkit.JavascriptInterface;
  import android.webkit.WebView;
  import android.webkit.WebViewClient;
  import android.widget.Toast;
  
  public class MainActivity extends Activity {
  
  
      private WebView mWebview ;
  
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
  
          super.onCreate(savedInstanceState);
  
          mWebview = new WebView(this);
  
          mWebview.getSettings().setJavaScriptEnabled(true); 
  
          final Activity activity = this;
  
          mWebview.setWebViewClient(new WebViewClient() {
              public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                  Toast.makeText(activity, description, Toast.LENGTH_SHORT).show();
              }
  
          });
          mWebview .loadUrl("file:///android_asset/app/index.html");
          //setContentView(mWebview);
  
  
      }
  
  
  
      @Override
      public boolean onKeyDown(int keyCode, KeyEvent event) {
          if(event.getAction() == KeyEvent.ACTION_DOWN){
              switch(keyCode)
              {
              case KeyEvent.KEYCODE_BACK:
                  if(mWebview.canGoBack() == true){
                      mWebview.goBack();
                  }else{
                      finish();
                  }
                  return true;
              }
  
          }
          return super.onKeyDown(keyCode, event);
      }
  
  }
  </code></pre>
  
  <hr>
  
  <h2>activity_main.xml</h2>
  
  <pre><code>    &lt;LinearLayout
       xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
      xmlns:tools="http://schemas.android.com/tools"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".MainActivity" &gt;
  
      &lt;WebView
          android:id="@+id/webView1"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          /&gt;
  
              &lt;com.google.ads.AdView
              android:id="@+id/adView"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              ads:adSize="BANNER"
              ads:adUnitId="MYIDMYIDMYID"
              ads:loadAdOnCreate="true"
  
               &gt;
          &lt;/com.google.ads.AdView&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>