title: My basic Q&A app will not run
body: <p>I made a basic Q&amp;A app that takes in an answer and produces an output on a small text field when a button is pressed. But I keep getting the error message on my emulator "Unfortunately App has stopped".</p>
  
  <p>Here is the java: </p>
  
  <pre><code>import android.os.Bundle;
  import android.support.design.widget.FloatingActionButton;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.View;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class MainActivity extends AppCompatActivity {
  
  public int score = 0; //answer score
  final  TextView Score = (TextView) findViewById(R.id.Score);
  Button b = (Button)findViewById(R.id.button); //button
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
  
      question1(); //call params for question
  
      //button listener, when button clicked, produce output on textfield "Score"
      b.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Score.setText(String.valueOf(score));
          }
  
      });
  
      FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
      fab.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                      .setAction("Action", null).show();
          }
      });
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.menu_main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
  
      //noinspection SimplifiableIfStatement
      if (id == R.id.action_settings) {
          return true;
      }
  
      return super.onOptionsItemSelected(item);
  }
  
  public void question1(){
      String Question1 = "Question 1";
  
      TextView t = (TextView) findViewById(R.id.Question);
      TextView A = (TextView) findViewById(R.id.AnswerA);
      TextView B = (TextView) findViewById(R.id.AnswerB);
      TextView C = (TextView) findViewById(R.id.AnswerC);
      TextView D = (TextView) findViewById(R.id.AnswerD);
  
      Score.setText(String.valueOf(score));
  
      t.setText("Question 1");
      A.setText("Answer A");
      B.setText("Answer B");
      C.setText("Answer C");
      D.setText("Answer D");
  
  }
  
  public int onCheckboxClickedA(){
      return score = score + 1;
  }
  public int onCheckboxClickedB(){
      return score = score + 2;
  }
  public int onCheckboxClickedC(){
      return score = score + 3;
  }
  public int onCheckboxClickedD(){
      return score = score + 4;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here is the XML:
      
  </p>
  
  <pre><code>&lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="Large Text"
      android:id="@+id/Question"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true" /&gt;
  
  &lt;CheckBox
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/AnswerA"
      android:layout_below="@+id/Question"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_marginTop="58dp"
      android:checked="false"
      android:layout_toLeftOf="@+id/Question"
      android:layout_toStartOf="@+id/Question"
      android:onClick="onCheckboxClickedA"/&gt;
  
  &lt;CheckBox
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/AnswerB"
      android:checked="false"
      android:layout_below="@+id/AnswerA"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:onClick="onCheckboxClickedB"/&gt;
  
  &lt;CheckBox
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="New CheckBox"
      android:id="@+id/AnswerC"
      android:layout_below="@+id/AnswerB"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:checked="false"
      android:onClick="onCheckboxClickedC"/&gt;
  
  &lt;CheckBox
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="New CheckBox"
      android:id="@+id/AnswerD"
      android:layout_below="@+id/AnswerC"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:checked="false"
      android:onClick="onCheckboxClickedD"/&gt;
  
  &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="New Button"
      android:id="@+id/button"
      android:layout_below="@+id/AnswerD"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="78dp" /&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="Large Text"
      android:id="@+id/Score"
      android:layout_below="@+id/button"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="54dp" /&gt;
  </code></pre>
  
  <p></p>