1

I changed my xbl from just having checkboxes in the layout to them being in a scrollview. That way I can add more without troubling users with an options page. When I do this I get the following error: http://pastebin.com/T5hZHRxu

Here is the xml part that was changed:

<View
    android:id="@+id/view2"
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:layout_above="@+id/scrollbox1"
    android:layout_alignLeft="@+id/textView4"
    android:layout_alignRight="@+id/num_input"
    android:layout_marginBottom="14dp"
    android:background="#808080" />
<ScrollView
android:id="@+id/scrollbox1"
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_above="@+id/view1" >
    <TableLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:stretchColumns="1">
        <CheckBox
        android:id="@+id/chex"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/cb" />
        <CheckBox
        android:id="@+id/chex2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="28dp"
        android:text="@string/ac" />

  </TableLayout>

</ScrollView>

<View
    android:id="@+id/view1"
    android:layout_width="fill_parent"
    android:layout_height="1dp"
    android:layout_above="@+id/aboutButt"
    android:layout_alignLeft="@+id/aboutButt"
    android:layout_alignRight="@+id/view2"
    android:layout_marginBottom="14dp"
    android:background="#808080" />
imattxc
  • 41
  • 2
  • 9

1 Answers1

0

Sometimes when you change/add xml files and/or Views you will get this funny ClassCastException error. The editor just doesn't realize that they have been changed appropriately. Cleaning the project allows Eclipse to "sort through" the changes, I guess you could say. It rebuilds the project so Eclipse can "see" what is what and where everything is.

Basically, if you get a funny error like this, such as it saying it can't cast one View to another when you know you aren't trying to cast it, first thing to do is to clean the project

Project --> Clean --> Choose your project to clean

Here is a SO post that may explain it better

Community
  • 1
  • 1
codeMagic
  • 44,549
  • 13
  • 77
  • 93