 <p>Upper casting is only allowed along upwards the hierarchy. <code>Button</code> never lies in the hierarchy of <code>LinearLayout</code>. So, you can't.</p> <pre><code>java.lang.Object ↳ android.view.View ↳ android.widget.TextView ↳ android.widget.Button </code></pre>