[java] strange error in my Animation Drawable

A strange error when trying to start Activity.

i think the error in my Animation Drawable

LogCat:

    12-31 06:37:45.138: E/AndroidRuntime(922): FATAL EXCEPTION: main     12-31 06:37:45.138: E/AndroidRuntime(922): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.MalekAlrwily.BasicVaccinations/com.MalekAlrwily.BasicVaccinations.Main}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.access$600(ActivityThread.java:141)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.os.Handler.dispatchMessage(Handler.java:99)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.os.Looper.loop(Looper.java:137)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.main(ActivityThread.java:5103)     12-31 06:37:45.138: E/AndroidRuntime(922):  at java.lang.reflect.Method.invokeNative(Native Method)     12-31 06:37:45.138: E/AndroidRuntime(922):  at java.lang.reflect.Method.invoke(Method.java:525)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)     12-31 06:37:45.138: E/AndroidRuntime(922):  at dalvik.system.NativeStart.main(Native Method)     12-31 06:37:45.138: E/AndroidRuntime(922): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.createView(LayoutInflater.java:620)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.inflate(LayoutInflater.java:469)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.Activity.setContentView(Activity.java:1895)     12-31 06:37:45.138: E/AndroidRuntime(922):  at com.MalekAlrwily.BasicVaccinations.Main.onCreate(Main.java:15)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.Activity.performCreate(Activity.java:5133)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)     12-31 06:37:45.138: E/AndroidRuntime(922):  ... 11 more     12-31 06:37:45.138: E/AndroidRuntime(922): Caused by: java.lang.reflect.InvocationTargetException     12-31 06:37:45.138: E/AndroidRuntime(922):  at java.lang.reflect.Constructor.constructNative(Native Method)     12-31 06:37:45.138: E/AndroidRuntime(922):  at java.lang.reflect.Constructor.newInstance(Constructor.java:417)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.LayoutInflater.createView(LayoutInflater.java:594) 12-31 06:37:45.138: E/AndroidRuntime(922):  ... 23 more     12-31 06:37:45.138: E/AndroidRuntime(922): Caused by: java.lang.OutOfMemoryError     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:503)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:356)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:800)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.content.res.Resources.loadDrawable(Resources.java:2105)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.content.res.Resources.getDrawable(Resources.java:695)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:282)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:901)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.graphics.drawable.Drawable.createFromXml(Drawable.java:837)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.content.res.Resources.loadDrawable(Resources.java:2087)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.View.<init>(View.java:3364)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.View.<init>(View.java:3293)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.view.ViewGroup.<init>(ViewGroup.java:453)     12-31 06:37:45.138: E/AndroidRuntime(922):  at android.widget.RelativeLayout.<init>(RelativeLayout.java:242)     12-31 06:37:45.138: E/AndroidRuntime(922):  ... 26 more 

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:layout_above="@+id/button1" android:layout_centerHorizontal="true" android:background="@drawable/animation" android:gravity="center_horizontal" android:orientation="vertical" 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=".Main" >      <ImageButton         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignParentBottom="true"         android:layout_centerHorizontal="true"         android:background="@android:color/transparent"         android:onClick="onClick"         android:src="@drawable/next" />  </RelativeLayout> 

AnimationDrawable:

<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" >     <item  android:drawable="@drawable/begin1" android:duration="3000" />     <item  android:drawable="@drawable/begin2" android:duration="3000" />     <item  android:drawable="@drawable/begin3" android:duration="3000" />     <item  android:drawable="@drawable/begin4" android:duration="3000" />     <item  android:drawable="@drawable/begin5" android:duration="3000" />     <item  android:drawable="@drawable/begin6" android:duration="3000" />     <item  android:drawable="@drawable/begin7" android:duration="3000" />     <item  android:drawable="@drawable/begin8" android:duration="3000" />     <item  android:drawable="@drawable/begin9" android:duration="3000" /> </animation-list> 

This question is related to java android xml eclipse logcat

The answer is


Looks like whatever is in your Animation Drawable definition is too much memory to decode and sequence. The idea is that it loads up all the items and make them in an array and swaps them in and out of the scene according to the timing specified for each frame.

If this all can't fit into memory, it's probably better to either do this on your own with some sort of handler or better yet just encode a movie with the specified frames at the corresponding images and play the animation through a video codec.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to android

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How to implement a simple scenario the OO way My eclipse won't open, i download the bundle pack it keeps saying error log getting " (1) no such column: _id10 " error java doesn't run if structure inside of onclick listener Cannot retrieve string(s) from preferences (settings) strange error in my Animation Drawable how to put image in a bundle and pass it to another activity FragmentActivity to Fragment A failure occurred while executing com.android.build.gradle.internal.tasks

Examples related to xml

strange error in my Animation Drawable How do I POST XML data to a webservice with Postman? PHP XML Extension: Not installed How to add a Hint in spinner in XML Generating Request/Response XML from a WSDL Manifest Merger failed with multiple errors in Android Studio How to set menu to Toolbar in Android How to add colored border on cardview? Android: ScrollView vs NestedScrollView WARNING: Exception encountered during context initialization - cancelling refresh attempt

Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to logcat

strange error in my Animation Drawable Android Studio - ADB Error - "...device unauthorized. Please check the confirmation dialog on your device." Couldn't load memtrack module Logcat Error sendUserActionEvent() is null Android studio logcat nothing to show Restore LogCat window within Android Studio error opening trace file: No such file or directory (2) Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one? How to filter Android logcat by application? Filter output in logcat by tagname