title: I am getting an error that is attempting to invoke a method on a null reference but I cannot debug it
body: <p>I am following along with the book Learning Java by Building Android Games by John Horton and for its first example, the Math Game, I am getting the following error when ran. </p>
  
  <blockquote>
    <p>java.lang.NullPointerException: Attempt to invoke virtual method 'void
    android.widget.TextView.setText(java.lang.CharSequence)' on a null
    object reference</p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <p><strong>Game Activity</strong></p>
  
  <pre><code>package com.example.mike.mathgame;
  import android.app.Activity;
  import android.os.Bundle;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class GameActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          // Loads up UI
          setContentView(R.layout.activity_main);
  
          int partA = 2;
          int partB = 3;
          int correctAnswer = partA * partB;
          int wrongAnswer1 = correctAnswer - 1;
          int wrongAnswer2 = correctAnswer + 1;
  
          TextView textObjectPartA = (TextView)findViewById(R.id.textPartA);
          TextView textObjectPartB = (TextView)findViewById(R.id.textPartB);
          Button buttonObjectChoice1 = (Button)findViewById(R.id.buttonChoice1);
          Button buttonObjectChoice2 = (Button)findViewById(R.id.buttonChoice2);
          Button buttonObjectChoice3 = (Button)findViewById(R.id.buttonChoice3);
  
          textObjectPartA.setText("" + partA);
          textObjectPartB.setText("" + partB);
  
          buttonObjectChoice1.setText("" + correctAnswer);
          buttonObjectChoice2.setText("" + wrongAnswer1);
          buttonObjectChoice3.setText("" + wrongAnswer2);
  
  
  
      }
  }
  </code></pre>
  
  <p><strong>Main Activity</strong></p>
  
  <pre><code>package com.example.mike.mathgame;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  
  
  public class MainActivity extends Activity implements View.OnClickListener{
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          final Button buttonPlay = (Button)findViewById(R.id.buttonPlay);
          buttonPlay.setOnClickListener(this);
      }
  
      @Override
      public void onClick(View view){
          Intent i;
          i = new Intent(this, GameActivity.class);
          startActivity(i);
      }
  }
  </code></pre>
  
  <p><strong>Content_game</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  app:layout_behavior="@string/appbar_scrolling_view_behavior"
  tools:context="com.example.mike.mathgame.GameActivity"
  tools:showIn="@layout/activity_game"&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="2"
      android:id="@+id/textPartA"
      android:layout_marginTop="83dp"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true" /&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="x"
      android:id="@+id/textOperator"
      android:layout_alignTop="@+id/textPartA"
      android:layout_centerHorizontal="true" /&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="2"
      android:id="@+id/textPartB"
      android:layout_alignTop="@+id/textOperator"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true" /&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="="
      android:id="@+id/textView2"
      android:layout_marginTop="64dp"
      android:layout_below="@+id/textOperator"
      android:layout_alignLeft="@+id/textOperator"
      android:layout_alignStart="@+id/textOperator" /&gt;
  
  &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="4"
      android:id="@+id/buttonChoice1"
      android:layout_centerVertical="true"
      android:layout_centerHorizontal="true" /&gt;
  
  &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="5"
      android:id="@+id/buttonChoice2"
      android:layout_below="@+id/buttonChoice1"
      android:layout_alignLeft="@+id/buttonChoice1"
      android:layout_alignStart="@+id/buttonChoice1" /&gt;
  
  &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="6"
      android:id="@+id/buttonChoice3"
      android:layout_below="@+id/buttonChoice2"
      android:layout_centerHorizontal="true" /&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>activity_game</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;android.support.design.widget.AppBarLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:theme="@style/AppTheme.AppBarOverlay"&gt;
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:background="?attr/colorPrimary"
          app:popupTheme="@style/AppTheme.PopupOverlay" /&gt;
  
  &lt;/android.support.design.widget.AppBarLayout&gt;
  
  &lt;include layout="@layout/content_game" /&gt;
  
  &lt;android.support.design.widget.FloatingActionButton
      android:id="@+id/fab"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom|end"
      android:layout_margin="@dimen/fab_margin"
      android:src="@android:drawable/ic_dialog_email" /&gt;
  </code></pre>
  
  <p></p>