Well since your code is extremely large I'll put a scenario to how to do it and you can guide with my code.
1. First of all make sure you have the code of Google as services
in your build.gradle
compile 'com.google.android.gms:play-services:7.0.0'
2. Add those lines on your manifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
3. On your Activity
where you want to add the ad view
should contains this code :
private InterstitialAd mInterstitialAd;
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId(getString(R.string.ad_unit_id));
if (mInterstitialAd != null && mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
else {
if (!mInterstitialAd.isLoaded() && !mInterstitialAd.isLoaded()) {
AdRequest adRequest = new AdRequest.Builder().build();
mInterstitialAd.loadAd(adRequest);
}
}
If you want to add it programmatically you should include your WebView
on a LinearLayout
(easier) and then add it doing this :
private AdView adView;
adView = new AdView(this, AdSize.INTERSTITIAL, getString(R.string.ad_unit_id));
LinearLayout root = (LinearLayout)findViewById(R.id.your_main_LinearLayout);
root.addView(adView);
adView.loadAd(new AdRequest());
And if you don't want to do it programmatically just add the AdView
on your xml
file below the WebView
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="false"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="INTERSTITIAL"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>