/**
 * Copyright Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.samples.quickstart.admobexample;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
// [SNIPPET load_banner_ad]
// Load an ad into the AdView.
// [START load_banner_ad]
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;


public class MainActivity extends AppCompatActivity {

    private AdView mAdView;
    private InterstitialAd mInterstitialAd;
    private Button mLoadInterstitialButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);
        // [END load_banner_ad]

        // [START instantiate_interstitial_ad]
        // Create an InterstitialAd object. This same object can be re-used whenever you want to
        // show an interstitial.
        mInterstitialAd = new InterstitialAd(this);
        mInterstitialAd.setAdUnitId(getString(R.string.test_interstitial_ad_unit_id));
        // [END instantiate_interstitial_ad]

        mInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdClosed() {
                requestNewInterstitial();
                beginSecondActivity();
            }
        });

        // [START display_interstitial_ad]
        mLoadInterstitialButton = (Button) findViewById(R.id.load_interstitial_button);
        mLoadInterstitialButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mInterstitialAd.isLoaded()) {
                    mInterstitialAd.show();
                } else {
                    beginSecondActivity();
                }
            }
        });
        // [END display_interstitial_ad]
    }

    /**
     * Load a new interstitial ad asynchronously.
     */
    // [START request_new_interstitial]
    private void requestNewInterstitial() {
        AdRequest adRequest = new AdRequest.Builder()
                .build();

        mInterstitialAd.loadAd(adRequest);
    }
    // [END request_new_interstitial]

    private void beginSecondActivity() {
        Intent intent = new Intent(this, SecondActivity.class);
        startActivity(intent);
    }

    // [START add_lifecycle_methods]
    /** Called when leaving the activity */
    @Override
    public void onPause() {
        if (mAdView != null) {
            mAdView.pause();
        }
        super.onPause();
    }

    /** Called when returning to the activity */
    @Override
    public void onResume() {
        super.onResume();
        if (mAdView != null) {
            mAdView.resume();
        }
        if (!mInterstitialAd.isLoaded()) {
            requestNewInterstitial();
        }
    }

    /** Called before the activity is destroyed */
    @Override
    public void onDestroy() {
        if (mAdView != null) {
            mAdView.destroy();
        }
        super.onDestroy();
    }
    // [END add_lifecycle_methods]
}

@@ -816,16 +816,62 @@
 Button;%0A
+import com.google.android.gms.ads.AdListener;%0A
 // %5BSNIP
@@ -951,54 +951,8 @@
 ad%5D%0A
-import com.google.android.gms.ads.AdListener;%0A
 impo
@@ -1030,24 +1030,43 @@
 ads.AdView;%0A
+// %5BSTART_EXCLUDE%5D%0A
 import com.g
@@ -1103,16 +1103,33 @@
 tialAd;%0A
+// %5BEND_EXCLUDE%5D%0A
 %0A%0Apublic
@@ -1205,16 +1205,39 @@
 AdView;%0A
+    // %5BSTART_EXCLUDE%5D%0A
     priv
@@ -1315,16 +1315,37 @@
 lButton;
+%0A    // %5BEND_EXCLUDE%5D
 %0A%0A    @O
@@ -2045,24 +2045,75 @@
 titial_ad%5D%0A%0A
+        // %5BSTART create_interstitial_ad_listener%5D%0A
         mInt
@@ -2305,32 +2305,32 @@
 ;%0A            %7D%0A
-
         %7D);%0A%0A   
@@ -2324,16 +2324,65 @@
      %7D);
+%0A        // %5BEND create_interstitial_ad_listener%5D
 %0A%0A      

Add exclude regions to include code snippets. Also added additional include code snippet for ad listener.