Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android error inflating class on xml

I created a class where extends from ViewFlipper. When I try to instantiate on xml, it gives me this "error inflating class on xml"

FixedViewFlipper

public FixedViewFlipper(Context context)
{
    super(context);
}

public FixedViewFlipper(Context context, AttributeSet attrs)
{
    super(context, attrs);
}

Xml

<View class="com.touchcare.idealogix.android.FixedViewFlipper"
    android:id="@+id/flipperAdd"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    >
</View>

Logcat

EDIT: I am using TabActivity at my MainActivity.

like image 622
Comic Sans MS Lover Avatar asked Jul 01 '26 18:07

Comic Sans MS Lover


1 Answers

You just need view to not be capitalized -

<view 
    class="touchcare.idealogix.android.FixedViewFlipper"
    android:id="@+id/flipperAdd"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    >
</view>

It's perfectly valid syntax and is how its done in a lot of the google apps

like image 174
JRaymond Avatar answered Jul 04 '26 09:07

JRaymond