Whenever I run the app, a run-time error crashes the app. This is my log error:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.android.practiceset2/com.example.android.practiceset2.MainActivity}: android.view.InflateException: Binary XML file line #63: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
The error only appears if I draw a grey line between two views using a blank dark grey view of 1dp width in my XML file given below:
<LinearLayout 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"
android:orientation="vertical"
tools:context=".MainActivity">
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:orientation="horizontal">
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="Team A"
android:textSize="45sp" />
<TextView
android:id="@+id/scoreA_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="0"
android:textSize="45sp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="score3A"
android:text="+3 Points" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="score2A"
android:text="+2 Points" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="freeThrowA"
android:text="Free Throw" />
</android.support.v7.widget.LinearLayoutCompat>
<view
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@android:color/darker_gray" />
<android.support.v7.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="Team B"
android:textSize="45sp" />
<TextView
android:id="@+id/scoreB_text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="4dp"
android:text="0"
android:textSize="45sp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="score3B"
android:text="+3 Points" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="score2B"
android:text="+2 Points" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:gravity="center_horizontal"
android:onClick="freeThrowB"
android:text="Free Throw" />
</android.support.v7.widget.LinearLayoutCompat>
</android.support.v7.widget.LinearLayoutCompat>
<Button
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="65dp"
android:layout_weight="1"
android:gravity="center_horizontal"
android:onClick="reset"
android:text="Reset" />
</LinearLayout>
I cannot understand how drawing this line is causing an error. Is this the correct way to do this? If not, please suggest a way around it.