Greg
Greg

Reputation: 556

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.

Upvotes: 8

Views: 8715

Answers (3)

Aree Vanier
Aree Vanier

Reputation: 193

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

Upvotes: 1

Iman Dolatkia
Iman Dolatkia

Reputation: 69

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

Upvotes: 1

Jayson Tamayo
Jayson Tamayo

Reputation: 2811

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

Upvotes: 2

Related Questions