Create a layout in your xml file
-------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
In your Activity Page
---------------------------------------------
AdView adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(AD_UNIT_ID);
LinearLayout layout = (LinearLayout) findViewById(R.id.reklam);
layout.setVisibility(View.GONE);
// Request for Ads
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
// Start loading the ad in the background.
adView.loadAd(adRequest);
adView.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
// TODO Auto-generated method stub
super.onAdClosed();
}
@Override
public void onAdLoaded() {
// TODO Auto-generated method stub
super.onAdLoaded();
layout.addView(adView);
layout.setVisibility(View.VISIBLE);
}
@Override
public void onAdOpened() {
// TODO Auto-generated method stub
super.onAdOpened();
}
});
-------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/adView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
In your Activity Page
---------------------------------------------
AdView adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(AD_UNIT_ID);
LinearLayout layout = (LinearLayout) findViewById(R.id.reklam);
layout.setVisibility(View.GONE);
// Request for Ads
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.build();
// Start loading the ad in the background.
adView.loadAd(adRequest);
adView.setAdListener(new AdListener() {
@Override
public void onAdClosed() {
// TODO Auto-generated method stub
super.onAdClosed();
}
@Override
public void onAdLoaded() {
// TODO Auto-generated method stub
super.onAdLoaded();
layout.addView(adView);
layout.setVisibility(View.VISIBLE);
}
@Override
public void onAdOpened() {
// TODO Auto-generated method stub
super.onAdOpened();
}
});
Best Places To Bet On Boxing - Mapyro
ReplyDeleteWhere septcasino.com To https://access777.com/ Bet On Boxing. gri-go.com It's a sports betting event in which you bet on the outcome of a 출장샵 game. In ventureberg.com/ the boxing world, each player must decide if or not to