Error when setting Background [closed]

4

When you try to change the background (image or color) the following error occurs. What can it be?

MY XML

07-22 20:29:52.223    4967-4967/? 
E/AndroidRuntime﹕ FATAL EXCEPTION: main
 java.lang.RuntimeException: Unable to start activity ComponentInfo{priscilla.com.br.nossahistoria/priscilla.com.br.nossahistoria.SplashCreen}: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
                at android.app.ActivityThread.access$600(ActivityThread.java:123)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4424)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
                at dalvik.system.NativeStart.main(Native Method)
         Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class <unknown>
                at android.view.LayoutInflater.createView(LayoutInflater.java:606)
                at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
                at android.app.Activity.setContentView(Activity.java:1835)
                at priscilla.com.br.nossahistoria.SplashCreen.onCreate(SplashCreen.java:15)
                at android.app.Activity.performCreate(Activity.java:4465)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
                at android.app.ActivityThread.access$600(ActivityThread.java:123)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4424)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
                at dalvik.system.NativeStart.main(Native Method)
         Caused by: java.lang.reflect.InvocationTargetException
                at java.lang.reflect.Constructor.constructNative(Native Method)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
                at android.view.LayoutInflater.createView(LayoutInflater.java:586)
                at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
                at android.app.Activity.setContentView(Activity.java:1835)
                at priscilla.com.br.nossahistoria.SplashCreen.onCreate(SplashCreen.java:15)
                at android.app.Activity.performCreate(Activity.java:4465)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
                at android.app.ActivityThread.access$600(ActivityThread.java:123)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4424)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:511)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
                at dalvik.system.NativeStart.main(Native Method)
         Caused by: java.lang.OutOfMemoryError
                at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:483)
                at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:351)
                at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:773)
                at android.content.res.Resources.loadDrawable(Resources.java:1935)
                at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
                at android.view.View.<init>(View.java:2785)
                at android.view.ViewGroup.<init>(ViewGroup.java:385)
                at android.widget.LinearLayout.<init>(LinearLayout.java:174)
                at android.widget.LinearLayout.<init>(LinearLayout.java:170)
                at java.lang.reflect.Constructor.constructNative(Native Method)
                at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
                at android.view.LayoutInflater.createView(LayoutInflater.java:586)
                at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
                at android.view.LayoutInflater.onCreateView(LayoutInflater.java:653)
                at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:678)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:466)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
                at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
                at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:251)
                at android.app.Activity.setContentView(Activity.java:1835)
                at priscilla.com.br.nossahistoria.SplashCreen.onCreate(SplashCreen.java:15)
                at android.app.Activity.performCreate(Activity.java:4465)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
                at android.app.ActivityThread.access$600(ActivityThread.java:123)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
                at android.os.Handler.dispatchMessage(Handler.java:99)
                at android.os.Looper.loop(Looper.java:137)
                at android.app.ActivityThread.main(ActivityThread.java:4424)
                at java.lang.reflect.Method.invokeNative(Native Method)
                at java.lang.reflect.Method.invoke
    
asked by anonymous 22.07.2015 / 22:37

2 answers

0

Try to use a smaller image for your layout or see if your application is not consuming too much memory of the device, thus leaving little space for image rendering.

    
23.07.2015 / 16:59
0

The image is relatively large indeed. Different devices have different memory configurations, and a large image that is supported by one may not be supported by another. Resize the original image to smaller sizes and place each size in the appropriate res/drawable- folder ( res/drawable-mdpi , res/drawable-hdpi , res/drawable-xhdpi , etc.) so each device will load a picture of the appropriate size for its capacity. This question can help you calculate the appropriate sizes.

    
23.07.2015 / 17:21