I'm getting this error only sometimes and only in one device:
04-09 16:05:22.016: E/AndroidRuntime(31843): FATAL EXCEPTION: main
04-09 16:05:22.016: E/AndroidRuntime(31843): android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
04-09 16:05:22.016: E/AndroidRuntime(31843): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.LayoutInflater.rInflate(LayoutInflater.java
:746)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-09 16:05:22.016: E/AndroidRuntime(31843): at com.app.appgym.ActorRutina.onCreateView(ActorRutina.java:36)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1500)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1467)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.os.Handler.handleCallback(Handler.java:615)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.os.Handler.dispatchMessage(Handler.java:92)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.os.Looper.loop(Looper.java:213)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.app.ActivityThread.main(ActivityThread.java:4787)
04-09 16:05:22.016: E/AndroidRuntime(31843): at java.lang.reflect.Method.invokeNative(Native Method)
04-09 16:05:22.016: E/AndroidRuntime(31843): at java.lang.reflect.Method.invoke(Method.java:511)
04-09 16:05:22.016: E/AndroidRuntime(31843): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
04-09 16:05:22.016: E/AndroidRuntime(31843): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
04-09 16:05:22.016: E/AndroidRuntime(31843): at dalvik.system.NativeStart.main(Native Method)
04-09 16:05:22.016: E/AndroidRuntime(31843): Caused by: java.lang.reflect.InvocationTargetException
04-09 16:05:22.016: E/AndroidRuntime(31843): at java.lang.reflect.Constructor.constructNative(Native Method)
04-09 16:05:22.016: E/AndroidRuntime(31843): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
04-09 16:05:22.016: E/AndroidRuntime(31843): ... 22 more
04-09 16:05:22.016: E/AndroidRuntime(31843): Caused by: java.lang.OutOfMemoryError
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:500)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.content.res.Resources.loadDrawable(Resources.java:1935)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.View.<init>(View.java:3392)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.view.ViewGroup.<init>(ViewGroup.java:460)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.widget.LinearLayout.<init>(LinearLayout.java:180)
04-09 16:05:22.016: E/AndroidRuntime(31843): at android.widget.LinearLayout.<init>(LinearLayout.java:176)
04-09 16:05:22.016: E/AndroidRuntime(31843): ... 25 more
The device im using is xperia s, but in another smartphone I also use, zte v967s, this error never happens. How could I avoid this memory problem?
android.view.LayoutInflater. Instantiates a layout XML file into its corresponding View objects. It is never used directly. Instead, use Activity.
Put simply, an inflater allows you to create a View from a resource layout file so that you do not need to create everything programmatically. In your example, you inflate the layout R. layout. list_mobile .
The LayoutInflater class is used to instantiate the contents of layout XML files into their corresponding View objects. In other words, it takes an XML file as input and builds the View objects from it.
"Inflating" a view means taking the layout XML and parsing it to create the view and viewgroup objects from the elements and their attributes specified within, and then adding the hierarchy of those views and viewgroups to the parent ViewGroup.
use android:largeHeap="true" under the application tag of your manifest file, might solve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With