Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8139567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:52:05+00:00 2026-06-06T11:52:05+00:00

So I know that Error inflating class usually is because of a missing or

  • 0

So I know that “Error inflating class” usually is because of a missing or malformed constructor… But I let eclipse generate them and they look similar to other examples I’ve seen. The error points to my XML file where I’m trying to add the custom class to my layout.

I’d assume I have to declare the extended ImageView some how but I’m at a loss for how to do so. Any help you can provide would be appreciated.

Error

06-27 09:12:18.655: D/AndroidRuntime(1487): Shutting down VM
06-27 09:12:18.655: W/dalvikvm(1487): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
06-27 09:12:18.675: I/dalvikvm(1487): threadid=3: reacting to signal 3
06-27 09:12:18.715: I/dalvikvm(1487): Wrote stack traces to '/data/anr/traces.txt'
06-27 09:12:18.755: E/AndroidRuntime(1487): FATAL EXCEPTION: main
06-27 09:12:18.755: E/AndroidRuntime(1487): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mytheral.android.AnimationTimer/com.mytheral.android.AnimationTimer.AnimationTimerActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class AnimationImageView
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.os.Looper.loop(Looper.java:137)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.ActivityThread.main(ActivityThread.java:4424)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at java.lang.reflect.Method.invokeNative(Native Method)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at java.lang.reflect.Method.invoke(Method.java:511)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at dalvik.system.NativeStart.main(Native Method)
06-27 09:12:18.755: E/AndroidRuntime(1487): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class AnimationImageView
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:691)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:739)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.Activity.setContentView(Activity.java:1835)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at com.mytheral.android.AnimationTimer.AnimationTimerActivity.onCreate(AnimationTimerActivity.java:15)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.Activity.performCreate(Activity.java:4465)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-27 09:12:18.755: E/AndroidRuntime(1487):     ... 11 more
06-27 09:12:18.755: E/AndroidRuntime(1487): Caused by: java.lang.ClassNotFoundException: android.view.AnimationImageView
06-27 09:12:18.755: E/AndroidRuntime(1487):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.createView(LayoutInflater.java:552)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:636)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
06-27 09:12:18.755: E/AndroidRuntime(1487):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
06-27 09:12:18.755: E/AndroidRuntime(1487):     ... 21 more

XML File

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <AnimationImageView
        android:id="@+id/progress_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />

</LinearLayout>

AnimationTimerActivity

package com.mytheral.android.AnimationTimer;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

public class AnimationTimerActivity extends Activity {
    /** Called when the activity is first created. */

    private static final String TAG = "AnimationTimer";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Log.v(TAG, "onCreate");
        AnimationImageView image= (AnimationImageView) findViewById(R.id.progress_bar);

        image.StartAnimation();
    }
}

AnimationImageView

package com.mytheral.android.AnimationTimer;
import java.util.Timer;
import java.util.TimerTask;
import android.content.Context;
import android.net.Uri;
import android.os.Handler;
import android.os.Message;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.ImageView;

public class AnimationImageView extends ImageView {

    private static final String TAG = "AnimationImageView";

    private Timer imgTimer;
    private int currentFrame = 0;
    private int maxFrame = 269; //Testing Value
    private String fileName = "green_flag_"; //Testing Value

    public int getCurrentFrame() {
        return currentFrame;
    }

    public void setCurrentFrame(int currentFrame) {
        this.currentFrame = currentFrame;
    }

    public int getMaxFrame() {
        return maxFrame;
    }

    public void setMaxFrame(int maxFrame) {
        this.maxFrame = maxFrame;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public AnimationImageView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

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

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

    public void StartAnimation() {

        Log.v(TAG, "onCreate");

        currentFrame = 0;
        maxFrame = 269;
        imgTimer = new Timer();

        try {
            imgTimer.scheduleAtFixedRate(new TimerTask() {

                @Override
                public void run() {

                    imgUpdateHandler.sendEmptyMessage(0);

                }}, 0, 67);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private Handler imgUpdateHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            Log.v(TAG, "imgUpdateHandler: currentFrame: " + currentFrame);

            Uri imgUri;

            if (currentFrame <= maxFrame) 
            {
                int i = currentFrame;

                imgUri = Uri.parse("android.resource://com.mytheral.android.AnimationTimer/drawable/" + fileName + String.format("%04d", i));

                //Uncomment if images don't cycle... Prior Android work around
                //image.setImageURI(null);

                try {
                    setImageURI(imgUri);
                } catch (Exception e) {
                    e.printStackTrace();
                }

                currentFrame++;
            }

            if (currentFrame > maxFrame) 
            {
                Log.v(TAG, "imgUpdateHandler: stopAnimation");

                imgTimer.cancel();
                imgTimer.purge();
            }
        }       
    };
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:52:06+00:00Added an answer on June 6, 2026 at 11:52 am

    instead of this use

    <AnimationImageView
    

    use

    <com.mytheral.android.AnimationTimer.AnimationImageView
         android:id="@+id/progress_bar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher" />
    

    or

    <view class="com.mytheral.android.AnimationTimer.AnimationImageView"
             android:id="@+id/progress_bar"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_launcher" /> 
    

    />

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that messaging nil is not an error, and generally it's not an
I get that error with the following code. anyone know why? function validateAdminInput(){ var
When I type ctags -e it returns an error saying it doesn't know that
I have a syntax error that I don't know how to fix. This is
I know that it's a subject that can raise a lot of debate, but
I know that I should put all the html elements in body tag, but
I know that one can define an 'expected' exception in JUnit, doing: @Test(expect=MyException.class) public
I know that this error has been discussed elsewhere on the web, and this
Hi I know that this error which I'm going to show can't be fixed
First of all, I know that the error I am getting can be resolved

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.