Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to resolve this error: ClassCastException: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup

If this is the wrong place to ask this question, please direct me to a more appropriate location.

I am working on an Android project in Eclipse. When I attempt to view the Preference layout in graphical view, I keep getting this error:

ClassCastException: com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup

Here is my preferences.xml:

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceCategory android:title="General">
        <CheckBoxPreference android:title="Show default categories"
            android:defaultValue="true" android:key="default_categories" />
    </PreferenceCategory>
    <PreferenceCategory android:title="Export">
        <EditTextPreference android:key="default_emailaddress"
            android:defaultValue="@string/pref_export_defaultemail"
            android:title="Email Address" android:summary="@string/pref_export_emailsummary" />
        <EditTextPreference android:key="filename_prefix"
            android:defaultValue="@string/pref_export_defaultfilename"
            android:title="Filename Prefix" android:summary="@string/pref_export_filenamesummary" />
    </PreferenceCategory>
</PreferenceScreen>

I cannot for the life of me figure out what its talking about, my searches with google have not come up with anything substantial.

like image 1000
Greg Avatar asked Jun 15 '11 23:06

Greg


3 Answers

Change your editing configuration to Android 3.0(if you're using 2.3.3 and below).

like image 139
Jayson Tamayo Avatar answered Oct 31 '22 16:10

Jayson Tamayo


Close Your Eclipse and Restart it Again...Usually Disappears

like image 1
Iman Dolatkia Avatar answered Oct 31 '22 16:10

Iman Dolatkia


I had this issue. I changed the theme from "Project theme" to "Theme.Holo.Light.DarkActionBar" (my preferred theme) and it finally worked.

like image 1
Aree Vanier Avatar answered Oct 31 '22 18:10

Aree Vanier