title: Android error : TextView cannot be cast to android.view.ViewGroup
body: <p>I have looked at related questions but cant seem to find a solution. </p>
  
  <p>Relevant links</p>
  
  <p><a href="https://stackoverflow.com/questions/8526264/android-widget-textview-cannot-be-cast-to-android-view-viewgroup">android.widget.TextView cannot be cast to android.view.ViewGroup</a></p>
  
  <p><a href="https://stackoverflow.com/questions/11191040/android-java-lang-classcastexception-android-widget-imageview-cannot-be-cast-t">Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView</a></p>
  
  <p>This is my xml
   `</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; 
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical"
      android:paddingTop="30dp" &gt;
  
      &lt;TextView
          android:id="@+id/tvTestSpinner"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginTop="10dp"
          android:paddingLeft="10dp"
          android:text="Country List" &gt;
  
          &lt;Spinner
              android:id="@+id/countryField"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:prompt="@string/country_prompt" &gt;
          &lt;/Spinner&gt;
      &lt;/TextView&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>`</p>
  
  <p>And the error log is showing this stack trace</p>
  
  <pre><code>java.lang.ClassCastException: android.widget.TextView cannot be cast to android.view.ViewGroup
  at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:740)
  at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:711)
  at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:742)
  at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:711)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:372)
  at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:321)
  at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:324)
  at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:325)
  at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:372)
  at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(GraphicalEditorPart.java:1361)
  at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(GraphicalEditorPart.java:1115)
  at com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.activated(GraphicalEditorPart.java:941)
  at com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditorDelegate.delegatePageChange(LayoutEditorDelegate.java:450)
  at com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor.pageChange(CommonXmlEditor.java:358)
  at org.eclipse.ui.part.MultiPageEditorPart$2.widgetSelected(MultiPageEditorPart.java:290)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
  at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:774)
  at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:2746)
  at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1433)
  at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:257)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
  at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
  at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
  at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
  at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
  at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
  </code></pre>
  
  <p>Any help at all would be most welcome!</p>