I am trying to place some kind of ad in my Android app, but I have a problem ...
package com.dotgears.flappybird;
import android.app.Activity;
import android.os.Bundle;
import android.widget.LinearLayout;
import com.google.ads.*;
public class BannerSample extends Activity {
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
adView = new AdView(this, AdSize.BANNER, "...");
LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);
layout.addView(adView);
adView.loadAd(new AdRequest());
}
@Override
public void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
}
I followed Google dev, but on the adView.loadAd(new AdRequest());Eclipse line it says:
AdRequest () constructor not showing
Why is it not visible? I searched everywhere but found nothing.
source
share