title: Moving adMob ads to the bottom of Relative Layout crashes the app
body: <p>I'm implementing adMob ads to my app and I have a small problem with it. When I add the AdMob ads to my app and they're automatically positioned on the top of the layout it all works good. But when I try to move the ad down to the bottom of the relative layout the app crashes.</p>
  
  <p>Logcat:</p>
  
  <pre><code>08-14 13:57:53.126: E/AndroidRuntime(4141): FATAL EXCEPTION: main
  08-14 13:57:53.126: E/AndroidRuntime(4141): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.whizzappseasyvoicenotepad/com.whizzappseasyvoicenotepad.TabLayout}: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.whizzappseasyvoicenotepad/com.whizzappseasyvoicenotepad.MainActivity}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Chronometer
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.os.Handler.dispatchMessage(Handler.java:99)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.os.Looper.loop(Looper.java:137)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread.main(ActivityThread.java:5103)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at java.lang.reflect.Method.invokeNative(Native Method)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at java.lang.reflect.Method.invoke(Method.java:525)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at dalvik.system.NativeStart.main(Native Method)
  08-14 13:57:53.126: E/AndroidRuntime(4141): Caused by: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.whizzappseasyvoicenotepad/com.whizzappseasyvoicenotepad.MainActivity}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Chronometer
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread.startActivityNow(ActivityThread.java:2054)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:749)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.widget.TabHost.setCurrentTab(TabHost.java:413)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.widget.TabHost.addTab(TabHost.java:240)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at com.whizzappseasyvoicenotepad.TabLayout.onCreate(TabLayout.java:33)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.Activity.performCreate(Activity.java:5133)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     ... 11 more
  08-14 13:57:53.126: E/AndroidRuntime(4141): Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Chronometer
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at com.whizzappseasyvoicenotepad.MainActivity.onCreate(MainActivity.java:71)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.Activity.performCreate(Activity.java:5133)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
  08-14 13:57:53.126: E/AndroidRuntime(4141):     ... 21 more
  </code></pre>
  
  <p>I tested it, and everytime I implement ads, they work until I move them down to the bottom of the relative layout. What could be the problem? I can see from the logcat that there's a problem with ToggleButton so I even tried moving the togglebutton around the layout but it doesn't fix anything.</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context=".MainActivity" xmlns:app="http://schemas.android.com/apk/lib/com.google.ads"&gt;
  
  &lt;Chronometer
      android:id="@+id/timer"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_above="@+id/adView"
      android:layout_centerHorizontal="true"
      android:text="Chronometer" /&gt;
  
  &lt;ImageButton
      android:id="@+id/recButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_above="@+id/timer"
      android:layout_centerHorizontal="true"
      android:background="@null"
      android:onClick="recordBtnClick"
      android:src="@drawable/record_btn" /&gt;
  
  &lt;ToggleButton
      android:id="@+id/tBtn1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_alignParentTop="true"
      android:textOff="Touch to record"
      android:textOn="Touch to record" /&gt;
  
  &lt;com.google.ads.AdView
      xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
      android:id="@+id/adView"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_centerHorizontal="true"
      ads:loadAdOnCreate="true"
      ads:testDevices="TEST_EMULATOR, 3F40A7AF85746C87"
      app:adSize="BANNER"
      app:adUnitId="a1520b668ee78d8" &gt;
  &lt;/com.google.ads.AdView&gt;
  </code></pre>
  
  <p></p>