title: What is wrong with my layoutInflater?
body: <p>Following this tutorial on Youtube: <a href="https://www.youtube.com/watch?v=E6vE8fqQPTE&amp;index=8&amp;list=PLgCYzUzKIBE8TUoCyjomGFqzTFcJ05OaC" rel="nofollow noreferrer">https://www.youtube.com/watch?v=E6vE8fqQPTE&amp;index=8&amp;list=PLgCYzUzKIBE8TUoCyjomGFqzTFcJ05OaC</a>. My code is fine, saying there are no errors, but when I run this on the emulator in Android Studio 3.0.1, the App crashes. I'm using compiled/targetedSDK 27, minimum 18. Emulator API 27.</p>
  
  <p>StackTrace:</p>
  
  <pre><code>02-15 13:07:56.424 26483-26483/com.example.sjdav.listadapter E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                 Process: com.example.sjdav.listadapter, PID: 26483
                                                                                 android.view.InflateException: Binary XML file line #0: Can't convert value at index 4 to dimension: type=0x12
                                                                                 Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 4 to dimension: type=0x12
                                                                                     at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:730)
                                                                                     at android.view.ViewGroup$MarginLayoutParams.&lt;init&gt;(ViewGroup.java:7794)
                                                                                     at android.widget.LinearLayout$LayoutParams.&lt;init&gt;(LinearLayout.java:1976)
                                                                                     at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1874)
                                                                                     at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1872)
                                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
                                                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:866)
                                                                                     at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
                                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
                                                                                     &lt;!--PROBLEM LINE--&gt; at com.example.sjdav.listadapter.PersonListAdapter.getView(PersonListAdapter.java:63)&lt;/--PROBLEM LINE--&gt;
                                                                                     at android.widget.AbsListView.obtainView(AbsListView.java:2365)
                                                                                     at android.widget.ListView.makeAndAddView(ListView.java:2052)
                                                                                     at android.widget.ListView.fillDown(ListView.java:786)
                                                                                     at android.widget.ListView.fillFromTop(ListView.java:847)
                                                                                     at android.widget.ListView.layoutChildren(ListView.java:1826)
                                                                                     at android.widget.AbsListView.onLayout(AbsListView.java:2164)
                                                                                     at android.view.View.layout(View.java:19659)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:6075)
                                                                                     at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1083)
                                                                                     at android.view.View.layout(View.java:19659)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:6075)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
                                                                                     at android.view.View.layout(View.java:19659)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:6075)
                                                                                     at android.support.v7.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:443)
                                                                                     at android.view.View.layout(View.java:19659)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:6075)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
                                                                                     at android.view.View.layout(View.java:19659)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:6075)
                                                                                     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1791)
                                                                                     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1635)
                                                                                     at android.widget.LinearLayout.onLayout(LinearLayout.java:1544)
                                                                                     at android.view.View.layout(View.java:19659)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:6075)
                                                                                     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
                                                                                     at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
                                                                                     at com.android.internal.policy.DecorView.onLayout(DecorView.java:761)
                                                                                     at android.view.View.layout(View.java:19659)
                                                                                     at android.view.ViewGroup.layout(ViewGroup.java:6075)
                                                                                     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2496)
                                                                                     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2212)
                                                                                     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
                                                                                     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
                                                                                     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
                                                                                     at android.view.Choreographer.doCallbacks(Choreographer.java:723)
                                                                                     at android.view.Choreographer.doFrame(Choreographer.java:658)
                                                                                     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
                                                                                     at android.os.Handler.handleCallback(Handler.java:790)
                                                                                     at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                     at android.os.Looper.loop(Looper.java:164)
                                                                                     at android.app.ActivityThread.main(ActivityThread.java:6494)
                                                                                     at java.lang.reflect.Method.invoke(Native Method)
                                                                                     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
  </code></pre>
  
  <p>XML Activities: activity_main:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;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"
      tools:context="com.example.sjdav.listadapter.MainActivity"&gt;
  
  
      &lt;ListView
          android:id="@+id/listView1"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_alignParentStart="true"
          android:layout_alignParentTop="true" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>custom_list_view:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:weightSum="100"
      tools:context="com.example.sjdav.listadapter.PersonListAdapter"&gt;
  
      &lt;TextView
          android:id="@+id/textView1"
          android:gravity="center"
          android:textAlignment="center"
          android:text="textView1"
          android:layout_width="0dp"
          android:layout_height="60dp"
          android:layout_weight="33.3"/&gt;
  
      &lt;LinearLayout
          android:orientation="vertical"
          android:layout_width="0dp"
          android:layout_height="wrap_content"
          android:layout_weight="66.6"&gt;
  
          &lt;TextView
              android:id="@+id/textView2"
              android:gravity="center"
              android:text="textView2"
              android:layout_width="match_parent"
              android:layout_height="30dp" /&gt;
  
          &lt;TextView
              android:id="@+id/textView3"
              android:gravity="center"
              android:text="textView3"
              android:layout_width="match_parent"
              android:layout_height="30dp"
              android:layout_marginTop="@+id/textView2"/&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>PersonListAdapter Class:</p>
  
  <pre><code>public class PersonListAdapter extends ArrayAdapter&lt;Person&gt; {
  
          private static final String TAG = "PersonListAdapter";
  
          private Context mContext;
          private int mResource;
          private int lastPosition = 1;
  
          static class ViewHolder {
              TextView name;
              TextView birthday;
              TextView sex;
              // ImageView icon;
              // ProgressBar progressBar;
              // int position;
          }
  
          public PersonListAdapter(@NonNull Context context, int resource, ArrayList&lt;Person&gt; objects) {
              super(context, resource, objects);
              mContext = context;
              mResource = resource;
          }
  
          @NonNull
          @Override
          public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
              // Get the persons information
              String name = getItem(position).getName();
              String birthday = getItem(position).getBirthday();
              String sex = getItem(position).getSex();
  
              // Create the person object with the information
              Person person  = new Person(name, birthday, sex);
  
              Log.d(TAG, "getView: PersonListAdapter Person created.");
  
              // Create the anim View
              final View result;
  
              // ViewHolder Object
              ViewHolder viewHolder;
  
              // Create the LayoutInflater
              if (convertView == null) {
                  LayoutInflater layoutInflater = LayoutInflater.from(mContext);
                  Log.d(TAG, "getView: before convertView.");
                  &lt;!--PROBLEM LINE--&gt;convertView = layoutInflater.inflate(mResource, parent, false);&lt;/--PROBLEM LINE--&gt;
                  viewHolder = new ViewHolder();
                  viewHolder.name = (TextView) convertView.findViewById(R.id.textView1);
                  viewHolder.birthday = (TextView) convertView.findViewById(R.id.textView2);
                  viewHolder.sex = (TextView) convertView.findViewById(R.id.textView3);
                  result = convertView;
                  convertView.setTag(viewHolder);
              } else {
                  viewHolder = (ViewHolder) convertView.getTag();
                  result = convertView;
              }
  
  
              Animation animation = AnimationUtils.loadAnimation(mContext, (position &gt; lastPosition) ? R.anim.load_down_anim : R.anim.load_up_anim);
              result.startAnimation(animation);
              lastPosition = position;
  
              viewHolder.name.setText(person.getName());
              viewHolder.birthday.setText(person.getBirthday());
              viewHolder.sex.setText(person.getSex());
  
              return convertView;
          }
  
      }
  </code></pre>
  
  <p>MainActivity Class:</p>
  
  <pre><code>import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.ListView;
  
  import java.util.ArrayList;
  
  public class MainActivity extends AppCompatActivity {
  
      private static final String TAG = "MainActivity";
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Log.d(TAG, "onCreate: startedMain");
  
          ListView mListView = (ListView) findViewById(R.id.listView1);
  
          Person m1 = new Person("John", "01-01-2000", "male");
          Person m2 = new Person("John", "01-01-2000", "male");
          Person m3 = new Person("John", "01-01-2000", "male");
          Person m4 = new Person("John", "01-01-2000", "male");
          Person m5 = new Person("John", "01-01-2000", "male");
          Person m6 = new Person("John", "01-01-2000", "male");
          Person m7 = new Person("John", "01-01-2000", "male");
          Person m8 = new Person("John", "01-01-2000", "male");
          Person m9 = new Person("John", "01-01-2000", "male");
          Person m10 = new Person("John", "01-01-2000", "male");
          Person m11 = new Person("John", "01-01-2000", "male");
          Person m12 = new Person("John", "01-01-2000", "male");
          Person m13 = new Person("John", "01-01-2000", "male");
          Person m14 = new Person("John", "01-01-2000", "male");
          Person m15 = new Person("John", "01-01-2000", "male");
          Person m16 = new Person("John", "01-01-2000", "male");
          Person m17 = new Person("John", "01-01-2000", "male");
          Person m18 = new Person("John", "01-01-2000", "male");
          Person m19 = new Person("John", "01-01-2000", "male");
          Person m20 = new Person("John", "01-01-2000", "male");
  
          // Create ArrayList of Person Objects
  
          ArrayList&lt;Person&gt; personArrayList = new ArrayList&lt;&gt;();
          personArrayList.add(m1);
          personArrayList.add(m2);
          personArrayList.add(m3);
          personArrayList.add(m4);
          personArrayList.add(m5);
          personArrayList.add(m6);
          personArrayList.add(m7);
          personArrayList.add(m8);
          personArrayList.add(m9);
          personArrayList.add(m10);
          personArrayList.add(m11);
          personArrayList.add(m12);
          personArrayList.add(m13);
          personArrayList.add(m14);
          personArrayList.add(m15);
          personArrayList.add(m16);
          personArrayList.add(m17);
          personArrayList.add(m18);
          personArrayList.add(m19);
          personArrayList.add(m20);
  
          Log.d(TAG, "onCreate: personArrayList created.");
  
          // Person List Adapter
          PersonListAdapter adapter = new PersonListAdapter(this, R.layout.custom_list_view, personArrayList);
  
          mListView.setAdapter(adapter);
      }
  }
  </code></pre>
  
  <p>Person Class:</p>
  
  <pre><code>public class Person {
  
      private String name;
      private String birthday;
      private String sex;
  
      public Person(String name, String birthday, String sex) {
          this.name = name;
          this.birthday = birthday;
          this.sex = sex;
      }
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getBirthday() {
          return birthday;
      }
  
      public void setBirthday(String birthday) {
          this.birthday = birthday;
      }
  
      public String getSex() {
          return sex;
      }
  
      public void setSex(String sex) {
          this.sex = sex;
      }
  }
  </code></pre>
  
  <p>Manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.sjdav.listadapter"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>The exception in the StackTrace points to layoutInflater.inflate(mResource, parent, false). I'm not familiar with this. At the top the Stack:</p>
  
  <p>Process: com.example.sjdav.listadapter, PID: 26483                                                      android.view.InflateException: Binary XML file line #0: Can't convert value at index 4 to dimension: type=0x12
  Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 4 to dimension: type=0x12.</p>
  
  <p>So some conversion error is taking place and I cannot isolate it. Please Help! Thanks in advance!</p>