Mobfox - Banner Internet Connection

653 Views Asked by At

I'm trying to add a banner using Mobfox in my App. Following the guide provided by Mobfox I add this code into MainActivity.java in onCreate method:

layout = (RelativeLayout) findViewById(R.id.rel_lay);

if (mAdView != null) {
    mAdView = new AdView(this,"http://my.mobfox.com/request.php"
        , "fe96717d9875b9da4339ea5367eff1ec", true, true);
    mAdView = setAdListener(this);
    layout.addView(mAdView);
}

But I obtain this error: "The method setAdListener(MainActivity) is undefined for the type MainActivity". How to define that method? I can't find in the Mobfox's guide.

How to make the banner works?

1

There are 1 best solutions below

0
On

You have to set AdListener to your mAdView as shown in the MobFox Android SDK Setup Guide. Use the code below:

mAdView = new AdView(this, "http://my.mobfox.com/request.php",
    "fe96717d9875b9da4339ea5367eff1ec", true, true);
mAdView.setAdListener(this);
layout.addView(mAdView);

Your activity must implement AdListener.