title: Setting an event for a button
body: <p>I've asked a question similar to this. The point of this code is to check if a checklist is checked, if it is than it adds 1 to the score.
  I've been told that the problem is that I haven't set an event. Please explain what I need to do to make it work, I'm new to android development and have been stuck on this for a few days. Please give a code example with your answer.</p>
  
  <pre><code>package xyz.ashraf.whoisdelasalle;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.CheckBox;
  import android.widget.CompoundButton;
  import android.widget.TextView;
  import android.widget.CompoundButton.OnCheckedChangeListener;
  
  /**
   * Created by Ashraf on 3/2/2016.
   */
  public class check_Button extends Pop_sallian{
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.popwindow_sallian);
          // Connects The variable to an xml id
  
  
          TextView output = (TextView) findViewById(R.id.output);
  
          final int[] score = {0};
          //sets the variable to 0
  
  
  
           OnCheckedChangeListener checkedListener = new OnCheckedChangeListener() {
  
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                  switch(buttonView.getId()){
                      case R.id.concern:
                          score[0]++;
                          break;
                      case R.id.faith:
                          score[0]++;
                          break;
                      case R.id.respect:
                          score[0]++;
                          break;
                      case R.id.education:
                          score[0]++;
                          break;
                      case R.id.community:
                          score[0]++;
                          break;
                  }
              }
          };
  
          // adds the variables together to form a score
  
          if(score[0] == 0){
              output.setText("Come on! Get involved, your la sallian community needs you.");
          } else if(score[0] == 1){
              output.setText("Good start, keep going!");
          } else if(score[0] == 2){
              output.setText("Room to improve but doing good!");
          } else if(score[0] == 3){
              output.setText("Very good, others look up to you!");
          } else if(score[0] == 4){
              output.setText("Wow, you really are an inspiration");
          } else if(score[0] == 5){
              output.setText("Excellent! You're a leader in your la sallian community. Nice work!");
          } else{
              output.setText("Unknown");
          }
          // changes the output text based on score value
      }
  }
  </code></pre>
  
  <p>^^checklist code^^</p>
  
  <pre><code>package xyz.ashraf.whoisdelasalle;
  
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          Button b = (Button) findViewById(R.id.who);
          Button today = (Button) findViewById(R.id.today);
          Button sallian = (Button) findViewById(R.id.sallian);
          Button how = (Button) findViewById(R.id.toBe);
          Button moreInfo = (Button) findViewById(R.id.info);
  
          b.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  startActivity(new Intent(MainActivity.this, Pop.class));
              }
          });
  
          today.setOnClickListener(new View.OnClickListener(){
              @Override
              public void onClick(View v) {
                  startActivity(new Intent(MainActivity.this, Pop_today.class));
              }
          });
          sallian.setOnClickListener(new View.OnClickListener(){
              @Override
              public void onClick(View v) {
                  startActivity(new Intent(MainActivity.this, Pop_sallian.class));
              }
          });
          how.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  startActivity(new Intent(MainActivity.this, Pop_how.class));
              }
          });
          moreInfo.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  startActivity(new Intent(MainActivity.this, Pop_info.class));
              }
          });
      }
  }
  </code></pre>
  
  <p>^^Code where the button is and, when pressed calls on the checklist code, The Ok button is to close the pop up when pressed^^</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/ScrollView01"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  &lt;RelativeLayout
      android:layout_width="match_parent" android:layout_height="match_parent"&gt;
      android:elevation="8dp"
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Are you a Sallian?"
          android:id="@+id/textView7"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:textSize="30sp"
          android:textColor="#000000" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Do you meet the following prerequisites, if you do you may be a Sallian"
          android:id="@+id/textView8"
          android:layout_below="@+id/textView7"
          android:layout_centerHorizontal="true"
          android:textSize="20sp"
          android:textColor="#000000" /&gt;
  
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Are you concerened for the poor and Social Justice?"
          android:id="@+id/concern"
          android:textSize="18sp"
          android:layout_below="@+id/textView8"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="10dp" /&gt;
  
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Do you have faith in the presence of God?"
          android:id="@+id/faith"
          android:textSize="15sp"
          android:layout_below="@+id/concern"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="3dp" /&gt;
  
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Do you have Respect for all people?"
          android:id="@+id/respect"
          android:layout_below="@+id/faith"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="3dp"
          android:textSize="15sp" /&gt;
  
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Do you value education?"
          android:id="@+id/education"
          android:textSize="15sp"
          android:layout_below="@+id/respect"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="3dp" /&gt;
  
      &lt;CheckBox
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Are you inclusive in your community?"
          android:id="@+id/community"
          android:layout_below="@+id/education"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:textSize="15sp"
          android:checked="false" /&gt;
  
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Ok"
          android:id="@+id/okButton_sallian"
          android:layout_below="@+id/community"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:layout_marginRight="20dp"
          android:layout_marginTop="90dp"
          android:layout_marginBottom="20dp"
          android:background="#FAFAFA"
          android:textColor="#00E676"
          android:elevation="2dp" /&gt;
  
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Check"
          android:id="@+id/check"
          android:textColor="#00E676"
          android:elevation="2dp"
          android:background="#FAFAFA"
          android:layout_alignTop="@+id/okButton_sallian"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginLeft="20dp"/&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAppearance="?android:attr/textAppearanceSmall"
          android:id="@+id/output"
          android:textColor="#1eff00"
          android:textSize="23sp"
          android:layout_below="@+id/community"
          android:layout_centerHorizontal="true"
          android:layout_above="@+id/check" /&gt;
  &lt;/RelativeLayout&gt;
      &lt;/ScrollView&gt;
  </code></pre>
  
  <p>^^ xml code the code takes for^^</p>