import com.google.ads.*;
import com.google.ads.AdListener;
import com.google.ads.AdRequest;
import com.google.ads.InterstitialAd;
public class StartUp extends Activity implements AdListener {
private InterstitialAd interstitialAd;
AdView adView;
public static final String MY_PUBLISHER_ID = "abc";
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState); // call the superclass's method
setContentView(R.layout.main_first_page); // inflate the GUI
interstitialAd = new InterstitialAd(this, MY_PUBLISHER_ID); // Create an ad.
interstitialAd.setAdListener(this); // Set the AdListener.
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
interstitialAd.loadAd(adRequest);
if (interstitialAd.isReady()) {interstitialAd.show();}
Button ButtonIQ= (Button) findViewById(R.id.buttonA);
}
There is an error at public class StartUp, reported by Eclipse that "The type StartUp must implement the inherited abstract method AdListener.onPresentScreen(Ad)".
May I ask what is this and how could this be solved? Many thanks in advance!
An abstract class cannot be instantiated. You must create a "concrete" or real class which implements the abstract class, which you have done.
The abstract class may also define abstract methods which the concrete class must supply. In this case, you have not supplied a method for onPresentScreen(), hence the error you are seeing.
http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html
See the AdListener documentation for how to implement this method which is called when an ad is presented at full screen.
@Override
public void onPresentScreen() {
// called when a full screen ad is presented
}