Search code examples
androidadmobads

admob ads do not show up


I have successfully made my admob ads show up on the sample code provided by Google at http://code.google.com/mobile/ads/docs/android/fundamentals.html, but when it comes to my own app, they do not show up.

I've read some related questions but it doesn't seem to be an issue for the LinearLayout which I am using. One thing to notice is that in my app it extends ListActivity instead of Activity.

   <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:ads="http://schemas.android.com/apk/res/com.mypackage.myapp" 
       android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent">
      <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2">

        <com.google.ads.AdView android:id="@+id/adView"                          
            android:layout_width="wrap_content"                          
            android:layout_height="fill_parent"                          
            ads:adUnitId="myadmobid"                          
            ads:adSize="BANNER"/>  
    </LinearLayout>

    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="2">
        <TextView
            android:id="@+id/hottopictab"
            android:text="Deal"
            android:gravity="center_horizontal|center_vertical"
            android:background="#000000"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:textStyle="bold"
      android:typeface ="sans"
            android:layout_weight="1"/>

        <TextView
            android:id="@+id/newtopictab"
            android:text="()"
            android:gravity="center_horizontal|center_vertical"
            android:background="#000000"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:textStyle="bold"
      android:typeface ="sans"
            android:layout_weight="1"/>

        <TextView
            android:id="@+id/recommendtab"
            android:text=""
            android:gravity="center_horizontal"
            android:background="#000000"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1"/>

    <ImageButton 
            android:layout_height="fill_parent"
            android:id="@+id/refresh"
            android:background="#000000"
            android:src="@drawable/refresh"     
            android:layout_width="wrap_content" 
            android:layout_marginRight="6dip"    
        /> 


   </LinearLayout>            
   <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="40">

        <ListView
            android:id="@android:id/list"
            android:text="row one"
            android:textSize="15pt"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"/> 

    </LinearLayout>      
</LinearLayout>

Solution

  • Problem solved. It was due to not enough space "Not enough space to show ad! Wants: <480, 75>, Has: <336, 522>". When I enlarge my emulator, it works.