'InterstitialAd' is abstract; cannot be instantiated

Viewed 578

I'm updating one of my Android apps but I'm finding some problems concerning AdMob implementation (which was working well on previous versions).

This is my code:

public class Edition extends AppCompatActivity {

  private InterstitialAd mInterstitialAd;

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

        mInterstitialAd = new InterstitialAd(this); //ERROR
        mInterstitialAd.setAdUnitId(getString(R.string.full_screen_test_ad));
        mInterstitialAd.loadAd(new AdRequest.Builder().build());
        mInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdClosed() {
                mInterstitialAd.loadAd(new AdRequest.Builder().build());
            }
        });
  }
}

The initialize() method is called during my MainActivity.

But the following error appears on the marked line:

'InterstitialAd' is abstract; cannot be instantiated

Thanks in advance for any comment you can have!

0 Answers
Related