title: How to add AdView from AdMob to a ListView
body: <p>I'm confused at how to make adview from admob work with a listview. I'm new to ads and have just finished the basic tutorial but now trying to put in in my own app. I have some things commented out that I tried to do to begin with.</p>
  
  <pre><code>        // Create the adView
      AdView adView = new AdView(this, AdSize.BANNER, myID);
      // Lookup your LinearLayout assuming it’s been given
      // the attribute android:id="@+id/mainLayout"
     // LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);
      // Add the adView to it
      lv.addView(adView);
      // Initiate a generic request to load it with an ad
      adView.loadAd(new AdRequest());
  </code></pre>
  
  
  
  <p></p>
  
  <pre><code>&lt;TextView android:id="@+id/itemName" android:layout_width="wrap_content"
      android:layout_height="50dip" android:text="Test view" 
      android:textSize = "25sp"
      android:singleLine = "true"/&gt;
  </code></pre>
  
  <p></p>
  
  <blockquote>
    <p>04-01 19:28:58.163: ERROR/AndroidRuntime(421): FATAL EXCEPTION: main
    04-01 19:28:58.163: ERROR/AndroidRuntime(421):
    java.lang.RuntimeException: Unable to start activity
    ComponentInfo{org.demo.textaway2/org.demo.textaway2.TextAway2}:
    java.lang.UnsupportedOperationException: addView(View) is not
    supported in AdapterView 04-01 19:28:58.163:
    ERROR/AndroidRuntime(421):     at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
    04-01 19:28:58.163: ERROR/AndroidRuntime(421):     at
    android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    04-01 19:28:58.163: ERROR/AndroidRuntime(421):     at
    android.app.ActivityThread.access$2300(ActivityThread.java:125) 04-01
    19:28:58.163: ERROR/AndroidRuntime(421):     at
    android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    04-01 19:28:58.163: ERROR/AndroidRuntime(421):     at
    android.os.Handler.dispatchMessage(Handler.java:99) 04-01
    19:28:58.163: ERROR/AndroidRuntime(421):     at
    android.os.Looper.loop(Looper.java:123) 04-01 19:28:58.163:
    ERROR/AndroidRuntime(421):     at
    android.app.ActivityThread.main(ActivityThread.java:4627) 04-01
    19:28:58.163: ERROR/AndroidRuntime(421):     at
    java.lang.reflect.Method.invokeNative(Native Method) 04-01
    19:28:58.163: ERROR/AndroidRuntime(421):     at
    java.lang.reflect.Method.invoke(Method.java:521) 04-01 19:28:58.163:
    ERROR/AndroidRuntime(421):     at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    04-01 19:28:58.163: ERROR/AndroidRuntime(421):     at
    com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-01
    19:28:58.163: ERROR/AndroidRuntime(421):     at
    dalvik.system.NativeStart.main(Native Method) 04-01 19:28:58.163:
    ERROR/AndroidRuntime(421): Caused by:
    java.lang.UnsupportedOperationException: addView(View) is not
    supported in AdapterView 04-01 19:28:58.163:
    ERROR/AndroidRuntime(421):     at
    android.widget.AdapterView.addView(AdapterView.java:435) 04-01
    19:28:58.163: ERROR/AndroidRuntime(421):     at
    org.demo.textaway2.TextAway2.onCreate(TextAway2.java:164) 04-01
    19:28:58.163: ERROR/AndroidRuntime(421):     at
    android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    04-01 19:28:58.163: ERROR/AndroidRuntime(421):     at
    android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
    04-01 19:28:58.163: ERROR/AndroidRuntime(421):     ... 11 more</p>
  </blockquote>