public class MainActivity extends Activity {
private AdView adView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_activity);
adView = new AdView(this);
adView.setAdUnitId(<AdUnitId>);
adView.setAdSize(AdSize.BANNER);
((ViewGroup) findViewById(R.id.advertiseLayout)).addView(adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
@Override
protected void onResume() {
super.onResume();
adView.resume();
}
@Override
protected void onPause() {
adView.pause();
super.onPause();
}
@Override
protected void onDestroy() {
((ViewGroup) findViewById(R.id.advertiseLayout)).removeView(adView);
adView.destroy();
adView = null;
super.onDestroy();
}
}
--
---
You received this message because you are subscribed to the Google Groups "Google AdMob Ads Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to google-admob-ads-sdk+unsub...@googlegroups.com.