android admob button -


can't figure 1 out. have 5 buttons , 5th want display admob advertisement not work. i'm close! assistance appreciated. below activity.java , main.xml

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 activity first created. */ @override  public void oncreate(bundle savedinstancestate) {      super.oncreate(savedinstancestate);      setcontentview(r.layout.main);      //--> create adview     adview adview = new adview(this, adsize.banner, "a14e27391701ceb");     // lookup linearlayout assuming it’s been given     // attribute android:id="@+id/mainlayout"     button btn5 = (button)findviewbyid(r.id.btn_button05);     // add adview     btn5.addview(adview);     // initiate generic request load ad     adview.loadad(new adrequest());     //--> end admob adview } } 

and 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> 

there no addview(adview) method button.change button layout.

linearlayout layout = (linearlayout)findviewbyid(r.id.lout); // create adview     final adview adview = new adview(this, adsize.banner, "a14e27391701ceb");    // add adview layout.addview(adview);  // initiate generic request load ad adrequest request = new adrequest();  request.settesting(true); adview.loadad(request);    

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -