Class cast exception when inflating a custom Relative Layout?
<p>I get this exception when I try to inflate</p>

<p>07-22 19:15:39.903: ERROR/AndroidRuntime(3810): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout</p>

<p>I have a base class:</p>

<pre><code>public class UIBase extends RelativeLayout {}
</code></pre>

<p>And a more specific class:</p>

<pre><code>public class Countdown extends UIBase {}
</code></pre>

<p>Then I try to inflate and it exceptions:</p>

<pre><code>UIBase newView = (UIBase) inflater.inflate(layoutId, parent, true);
</code></pre>

<p>Here's the XML file:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;com.Countdown xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/countdown"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    &gt;
&lt;TextView
    android:id="@+id/countdownText"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:text="0" /&gt;
&lt;/com.Countdown&gt;
</code></pre>

<p>Does anyone know what I'm doing wrong?</p>
