NullPointerException
NullPointerException

Reputation: 37627

Can't implement adMob AdListener Class

Im getting this error:

- The type AdListener cannot be a superinterface of AdManager; a superinterface must be an 
         interface

When im trying to implement ADMOB AdListener on my app:

import com.google.android.gms.ads.AdListener;

public class AdManager implements AdListener{

What am i doing wrong?

Upvotes: 0

Views: 4260

Answers (2)

frankish
frankish

Reputation: 6826

According to the new SDK (Google Play Services)

You no longer implement AdListener from your Activity or class..

You can use it as an inner class:

adView.setAdListener(new AdListener() { public void onAdLoaded() {} public void onAdFailedToLoad(int errorcode) {} // Only implement methods you need. });

(Taken from: https://developers.google.com/mobile-ads-sdk/docs/admob/play-migration)

Upvotes: 7

Szymon
Szymon

Reputation: 43023

AdListener is a class, not an interface so your class needs to inherit from it, not implement it. Use extends keyword, not implements.

public class AdManager extends AdListener{
}

Upvotes: 4

Related Questions