Impossible de comprendre celui-ci. J'ai cinq boutons et le 5ème je veux montrer ma publicité d'AdMob mais cela ne fonctionnera tout simplement pas. Je suis si proche! Toute aide appréciée. Ci-dessous mon activity.java et mon main.xmlbouton android admob
package com.CompanyName.SANDBOX;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import com.google.ads.*;
public class SANDBOXActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//--> Create the adView
AdView adView = new AdView(this, AdSize.BANNER, "a14e27391701ceb");
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="@+id/mainLayout"
Button btn5 = (Button)findViewById(R.id.btn_Button05);
// Add the adView to it
btn5.addView(adView);
// Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
//--> End AdMoB adView
}
}
et mon main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/icon"
android:scaleType="centerInside">
<Button android:id="@+id/btn_Button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="Start SANDBOX Mobile">
</Button>
<Button android:id="@+id/btn_Button02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="More Applications">
</Button>
<Button android:id="@+id/btn_Button03"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="Share">
</Button>
<Button android:id="@+id/btn_Button04"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="Send feedback">
</Button>
<Button android:id="@+id/btn_Button05"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center_horizontal">
</Button>
</LinearLayout>
Quelle erreur recevez-vous? – Pengume
pas d'erreur du tout, il n'affiche tout simplement pas d'annonce de tout type –
Etes-vous sûr de vouloir avoir la permission d'accéder à internet? – Pengume