Hi,
I need to show one banner ad per one tabview, so I changes the android:id (check below code) and the add is successfully appears in all required tabs. Is it ok or its against Google's Terms of Service. Please tell me if any other way to show the ads
XML
First Layout
<com.google.android.gms.ads.AdView android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="@string/admobid"
ads:adSize="SMART_BANNER"/>
Second
<com.google.android.gms.ads.AdView android:id="@+id/adView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="@string/admobid"
ads:adSize="SMART_BANNER"/>
Third one
<com.google.android.gms.ads.AdView android:id="@+id/adView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="@string/admobid"
ads:adSize="SMART_BANNER"/>
Java code:
adView = (AdView)this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("356d67mydeviceid")
.build();
adView.loadAd(adRequest);
adView2 = (AdView)this.findViewById(R.id.adView2);
AdRequest adRequest2 = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("356d67mydeviceid")
.build();
adView2.loadAd(adRequest2);
adView3 = (AdView)this.findViewById(R.id.adView3);
AdRequest adRequest3 = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("356d67mydeviceid")
.build();
adView3.loadAd(adRequest3);
Output
Regards,
IndicSIS