I've been trying to load a list of records from a database to a screen but there seems to be a problem when the app gets the data and tries to display it on the screen. I read that sometimes this type of error is thrown when displaying large images and such but I have no images and tried some other solutions I've read about. Any input is appreciated!
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.blackfrogweb.macrotracker, PID: 16129
android.view.InflateException: Binary XML file line 23: Binary XML file line 23: Error inflating class <unknown>
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at com.blackfrogweb.macrotracker.FavsCustomAdapter.getView(FavsCustomAdapter.java:38)
at android.widget.AbsListView.obtainView(AbsListView.java:2346)
at android.widget.ListView.makeAndAddView(ListView.java:1876)
at android.widget.ListView.fillDown(ListView.java:702)
at android.widget.ListView.fillFromTop(ListView.java:763)
at android.widget.ListView.layoutChildren(ListView.java:1671)
at android.widget.AbsListView.onLayout(AbsListView.java:2148)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
at android.view.View.layout(View.java:16636)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Here is the xml of the layout Im trying to "inflate".
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingTop="16dp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:gravity="left">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/favorite_name"
android:textColor="@color/colorText"
android:textSize="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"/>
<TextView
android:id="@+id/favorite_cal"
android:textSize="?android:attr/textAppearanceMedium"
android:textColor="@color/colorText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"/>
<TextView
android:id="@+id/favorite_fat"
android:textSize="?android:attr/textAppearanceMedium"
android:textColor="@color/colorText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginBottom="5dp"/>
<TextView
android:id="@+id/favorite_carb"
android:textSize="?android:attr/textAppearanceMedium"
android:textColor="@color/colorText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginBottom="5dp"/>
<TextView
android:id="@+id/favorite_prot"
android:textSize="?android:attr/textAppearanceMedium"
android:textColor="@color/colorText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginBottom="5dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:gravity="right">
<Button
android:id="@+id/add"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="5dp"
android:background="@android:drawable/ic_menu_add"/>
<Button
android:id="@+id/edit"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="5dp"
android:background="@android:drawable/ic_menu_edit"/>
<Button
android:id="@+id/delete"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@android:drawable/ic_menu_delete"/>
</LinearLayout>
</LinearLayout>
Since I'm not really sure where the error is happening, I'm not sure what piece of code to post -and I don't want to make this unreadable.
Currenty you are setting ?android:attr/textAppearanceMedium
to android:textSize
.
You should replace the attribute with android:textAppearance
.
Change
android:textSize="?android:attr/textAppearanceMedium"
TO
android:textAppearance="?android:attr/textAppearanceMedium"
OR
Set direct value to android:textSize
like
android:textSize="10sp"