Several ImageView inside FrameLayout, an error occurs

3

Well the problem is the following I have some ImageView that are called by buttons, it works cool, but when defining 4 images it still goes well, I add another ImageView with another image to the error program, in that same ImagemView put an image of the 4 the program runs because this occurs?

Logcat:

02-01 17:53:07.950: E/AndroidRuntime(767): FATAL EXCEPTION: main
02-01 17:53:07.950: E/AndroidRuntime(767): Process: com.teste.testeaplicao, PID: 767
02-01 17:53:07.950: E/AndroidRuntime(767): java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.teste.testeaplicacao/com.teste.testeaplicao.Teste}: android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.ActivityThread.access$800(ActivityThread.java:135)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.os.Handler.dispatchMessage(Handler.java:102)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.os.Looper.loop(Looper.java:136)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.ActivityThread.main(ActivityThread.java:5017)
02-01 17:53:07.950: E/AndroidRuntime(767):  at java.lang.reflect.Method.invokeNative(Native Method)
02-01 17:53:07.950: E/AndroidRuntime(767):  at java.lang.reflect.Method.invoke(Method.java:515)
02-01 17:53:07.950: E/AndroidRuntime(767):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
02-01 17:53:07.950: E/AndroidRuntime(767):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
02-01 17:53:07.950: E/AndroidRuntime(767):  at dalvik.system.NativeStart.main(Native Method)
02-01 17:53:07.950: E/AndroidRuntime(767): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.view.LayoutInflater.createView(LayoutInflater.java:620)
02-01 17:53:07.950: E/AndroidRuntime(767):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
02-01 17:53:07.950: E/AndroidRuntime(767):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.Activity.setContentView(Activity.java:1929)
02-01 17:53:07.950: E/AndroidRuntime(767):  at com.teste.testeaplicacao.Teste.onCreate(Teste.java:40)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.Activity.performCreate(Activity.java:5231)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
02-01 17:53:07.950: E/AndroidRuntime(767):  ... 11 more
02-01 17:53:07.950: E/AndroidRuntime(767): Caused by: java.lang.reflect.InvocationTargetException
02-01 17:53:07.950: E/AndroidRuntime(767):  at java.lang.reflect.Constructor.constructNative(Native Method)
02-01 17:53:07.950: E/AndroidRuntime(767):  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.view.LayoutInflater.createView(LayoutInflater.java:594)
02-01 17:53:07.950: E/AndroidRuntime(767):  ... 24 more
02-01 17:53:07.950: E/AndroidRuntime(767): Caused by: java.lang.OutOfMemoryError
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:422)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.content.res.Resources.loadDrawable(Resources.java:2110)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.widget.ImageView.<init>(ImageView.java:129)
02-01 17:53:07.950: E/AndroidRuntime(767):  at android.widget.ImageView.<init>(ImageView.java:119)
02-01 17:53:07.950: E/AndroidRuntime(767):  ... 27 more
    
asked by anonymous 01.02.2015 / 22:45

1 answer

0

From your log we can analyze that the problem is in memory - OutOfMemory .

Usually this is due to the size of the images you are trying to render! I recommend you redesign the design of your app.

I noticed that you have FrameLayout that contains ImageView as background. It is? If it is, remove this and use the android:background="@drawable/..."

    
02.02.2015 / 18:38