Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error inflating class android.support.v7.internal.widget.ActionBarView

My application was working but when I came to start working on it this morning everything is not working. I am getting an error inflating class error which seems to be from an xml file where I get the "Binary XML file line #25" line. As I said this was working fine and now all of a sudden it does not. Below is the exception trace:

01-27 11:20:53.624: E/AndroidRuntime(7831): FATAL EXCEPTION: main
01-27 11:20:53.624: E/AndroidRuntime(7831): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ypmmllc.dailychecklist/com.ypmmllc.dailychecklist.TabbedActivity}: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2737)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2753)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.access$2500(ActivityThread.java:129)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2107)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.os.Looper.loop(Looper.java:143)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.main(ActivityThread.java:4701)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Method.invokeNative(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Method.invoke(Method.java:521)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at dalvik.system.NativeStart.main(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831): Caused by: android.view.InflateException: Binary XML file line #25: Error inflating class android.support.v7.internal.widget.ActionBarView
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.createView(LayoutInflater.java:513)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.parseInclude(LayoutInflater.java:677)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:614)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:203)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.Activity.setContentView(Activity.java:1647)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.app.ActionBarActivity.superSetContentView(ActionBarActivity.java:216)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:180)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:134)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:76)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at com.ypmmllc.dailychecklist.TabbedActivity.onCreate(TabbedActivity.java:30)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2701)
01-27 11:20:53.624: E/AndroidRuntime(7831):     ... 11 more
01-27 11:20:53.624: E/AndroidRuntime(7831): Caused by: java.lang.reflect.InvocationTargetException
01-27 11:20:53.624: E/AndroidRuntime(7831):     at android.support.v7.internal.widget.ActionBarView.<init>(ActionBarView.java:218)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Constructor.constructNative(Native Method)
01-27 11:20:53.624: E/AndroidRuntime(7831):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)

Here is the XML file it bombs on in my class at setContentView(R.layout.activity_tabbed), as this is the line where everything bombs out.

activity_tabbed.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".TabbedActivity" >


    <view class="com.ypmmllc.dailychecklist.CustomViewPager"
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    </view>
</RelativeLayout>

And now the CustomViewPager class that I am referencing within the XML file:

package com.ypmmllc.dailychecklist;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class CustomViewPager extends ViewPager {

    private boolean enabled;

    public CustomViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.enabled = false;
    }

    public CustomViewPager(Context context)
    {
        super(context);
        this.enabled = false;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (this.enabled) {
            return super.onTouchEvent(event);
        }

        return false;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event) {
        if (this.enabled) {
            return super.onInterceptTouchEvent(event);
        }

        return false;
    }

    public void setPagingEnabled(boolean enabled) {
        this.enabled = enabled;
    }
}
like image 353
user3241191 Avatar asked Jan 27 '14 16:01

user3241191


2 Answers

Try to clean up the project and rebuild it:

IntelliJ IDEA: Build -> Rebuild project; Eclipse: Project -> Clean

like image 113
Aleksey Avatar answered Nov 09 '22 13:11

Aleksey


Try this:

<com.ypmmllc.dailychecklist.CustomViewPager
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
like image 4
Imran Betara Avatar answered Nov 09 '22 13:11

Imran Betara