title: How can I add values to Radio Buttons and calculate answer?
body: <p>I have a simpe form with 4 activities containing eight radio buttons. When one activity is answered, it goes to the next, and I want at the fourth activity to show the result of the radio buttons checked. Can somebody help me add values to the radio buttons and calculate the answer?
  I want to create a psyhology test, and every radiobutton must have a different value. Adding them up will result in a unique psyhological profile.
  Here is one layout and activity from my application.
  I am new to this and I appreciate all the help I can get. Thank you!</p>
  
  <p>The layout:</p>
  
  <pre><code>    &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  &gt;
  
  
  &lt;TextView
  android:id="@+id/textView"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="@string/question_1"/&gt;
  
  &lt;RadioGroup 
  android:id="@+id/radiogroup"    
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent"&gt;
  
  &lt;RadioButton
  android:id="@+id/radiobutton1"  
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content" 
  android:text="@string/radio_1"/&gt;
  
  &lt;RadioButton
  android:id="@+id/radiobutton2"  
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content" 
  android:text="@string/radio_2"/&gt;
  &lt;/RadioGroup&gt;  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The activity:</p>
  
  <pre><code>package com.example.app_test;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.Menu;
  import android.widget.CompoundButton;
  import android.widget.CompoundButton.OnCheckedChangeListener;
  import android.widget.RadioButton;
  
  public class MainActivity extends Activity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
        RadioButton buttonOne = (RadioButton)findViewById(R.id.radiobutton1);
  
          buttonOne.setOnCheckedChangeListener(new OnCheckedChangeListener()
          {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
              {
                  if (isChecked)
                  {
                      //Go to the activity for button 1 here
                      MainActivity.this.startActivity(new Intent(MainActivity.this, SecondActivity.class));
                  }
              }
          });
  
          RadioButton buttonTwo = (RadioButton)findViewById(R.id.radiobutton2);
  
          buttonTwo.setOnCheckedChangeListener(new OnCheckedChangeListener()
          {
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
              {
                  if (isChecked)
                  {
                      //Go to the activity for button 2 here
                      MainActivity.this.startActivity(new Intent(MainActivity.this, SecondActivity.class));
                  }
              }
          });
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
  }
  </code></pre>