Banner Size Ad:-
Window window1 = this.getWindow();
LinearLayout adsLayout = new LinearLayout(this);
LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.FILL_PARENT);
// Displays Ads at the bottom of your sketch, use Gravity.TOP to display them at the top
adsLayout.setGravity(Gravity.BOTTOM);
AdView adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxx");
adsLayout.addView(adView);
AdRequest newAdReq = new AdRequest();
adView.loadAd(newAdReq);
window1.addContentView(adsLayout,lp2);
Note :U need to add GoogleAdMobAdsSdk-4 jar file in u r project
xxxxxxxxx replace with your ad mob Id
Window window1 = this.getWindow();
LinearLayout adsLayout = new LinearLayout(this);
LinearLayout.LayoutParams lp2 = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.FILL_PARENT);
// Displays Ads at the bottom of your sketch, use Gravity.TOP to display them at the top
adsLayout.setGravity(Gravity.BOTTOM);
AdView adView = new AdView(this, AdSize.BANNER, "xxxxxxxxxx");
adsLayout.addView(adView);
AdRequest newAdReq = new AdRequest();
adView.loadAd(newAdReq);
window1.addContentView(adsLayout,lp2);
Note :U need to add GoogleAdMobAdsSdk-4 jar file in u r project
xxxxxxxxx replace with your ad mob Id
No comments:
Post a Comment