title: getting selected radiobutton text as string
body: <p>I have created two activity one for registration details and another one for showing the value user has entered. But when I tried to get the value of radiobutton from the radiogroup selected. It doesn't show any error but when I debug and run in my phone. 
  And clicked the signup button
  <strong>It show app stopped working start again message</strong></p>
  
  <p>My MainActivity.java :</p>
  
  <pre><code>import android.app.DatePickerDialog;
  import android.app.Dialog;
  import android.app.TimePickerDialog;
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import java.util.Calendar;
  
  public class MainActivity extends AppCompatActivity {
  
  
      Button signUpButton,signInButton;
      TextView userTimeJoining, dateOfBirth;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
          signInButton = findViewById(R.id.signinbutton);
          signInButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
              }
          });
  
          signUpButton = findViewById(R.id.signupbutton);
          signUpButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  Intent gotoRegAct = new Intent(MainActivity.this, RegistrationActivity.class);
                  startActivity(gotoRegAct);
  
  
              }
          });
  
      }
  }
  </code></pre>
  
  <p>My RegistrationActivity.java :</p>
  
  <pre><code>import android.app.DatePickerDialog;
  import android.app.TimePickerDialog;
  import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.DatePicker;
  import android.widget.EditText;
  import android.widget.RadioButton;
  import android.widget.RadioGroup;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.TimePicker;
  import android.widget.Toast;
  
  import java.util.Calendar;
  
  public class RegistrationActivity extends AppCompatActivity {
  
  
      String courseList[] = {"Java","Python", "Android", "Kotlin"};
  
  
      Button submitButton;
      EditText nameOfUser, userGmail, userName, userPassword;
      TextView userDateOfBirth, userTimeOfJoining;
      Spinner mySpinnerForCourse;
      RadioGroup genderSelected;
      RadioButton selectedRadiobutton;
  
  
      String setTime;
      String setDate;
      String setGender=" ";
      int itemNoSelected;
  
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_registration);
  
  
  
  
          submitButton = findViewById(R.id.submitButton);
          nameOfUser = findViewById(R.id.nameofuser);
          userGmail = findViewById(R.id.usergmail);
          userName = findViewById(R.id.username);
          userPassword = findViewById(R.id.userpassword);
          userDateOfBirth = findViewById(R.id.userdateofbirth);
          userTimeOfJoining = findViewById(R.id.usertimeofjoining);
          mySpinnerForCourse = findViewById(R.id.usercourse);
          genderSelected = findViewById(R.id.usergender);
  
         //This is the code which is not working
          int selectedRadioButtonId = genderSelected.getCheckedRadioButtonId();
          selectedRadiobutton = (RadioButton) findViewById(selectedRadioButtonId);
          setGender = selectedRadiobutton.getText().toString();
  
          ArrayAdapter&lt;String&gt; arrayAdapterForCourse = new ArrayAdapter&lt;&gt;(this, android.R.layout.simple_spinner_dropdown_item,courseList);
          mySpinnerForCourse.setAdapter(arrayAdapterForCourse);
  
          mySpinnerForCourse.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
              @Override
              public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
                  itemNoSelected = i;
              }
  
              @Override
              public void onNothingSelected(AdapterView&lt;?&gt; adapterView) {
  
              }
          });
  
  
          userTimeOfJoining.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
                  Calendar calendar = Calendar.getInstance();
                  int hh = calendar.get(Calendar.HOUR);
                  int mm = calendar.get(Calendar.MINUTE);
  
                  TimePickerDialog timePickerDialog = new TimePickerDialog(RegistrationActivity.this, new TimePickerDialog.OnTimeSetListener() {
                      @Override
                      public void onTimeSet(TimePicker timePicker, int i, int i1) {
                          setTime = i+" : "+i1;
                          userTimeOfJoining.setText(setTime);
                      }
                  },
  
                          hh, mm, false);
                  timePickerDialog.show();
  
              }
          });
  
          userDateOfBirth.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Calendar calendar = Calendar.getInstance();
                  int dd = calendar.get(Calendar.DAY_OF_MONTH);
                  int mm = calendar.get(Calendar.MONTH);
                  int yy = calendar.get(Calendar.YEAR);
  
                  DatePickerDialog datePickerDialog = new DatePickerDialog(RegistrationActivity.this, new DatePickerDialog.OnDateSetListener() {
                      @Override
                      public void onDateSet(DatePicker datePicker, int i, int i1, int i2) {
                          setDate = i2+" / "+i1+" / "+i;
                          userDateOfBirth.setText(setDate);
                      }
                  }, yy, mm, dd);
                  datePickerDialog.show();
              }
          });
  
          submitButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Intent gotoShowInfo = new Intent(RegistrationActivity.this, ShowInfo.class);
  
                  Bundle bundleforenteredvalue = new Bundle();
  
                  bundleforenteredvalue.putString("enteredname",nameOfUser.getText().toString());
                  bundleforenteredvalue.putString("enteredgmail",userGmail.getText().toString());
                  bundleforenteredvalue.putString("enteredusername",userName.getText().toString());
                  bundleforenteredvalue.putString("enteredpassword",userPassword.getText().toString());
                  bundleforenteredvalue.putString("dateselected",setDate);
                  bundleforenteredvalue.putString("timeselected",setTime);
                  bundleforenteredvalue.putString("genderselected",setGender);
                  bundleforenteredvalue.putString("courseselected",courseList[itemNoSelected]);
  
                  gotoShowInfo.putExtras(bundleforenteredvalue);
  
                  startActivity(gotoShowInfo);
              }
          });
  
  
      }
  }
  </code></pre>
  
  <p>My ShowInfo.java :</p>
  
  <pre><code>import android.content.Intent;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class ShowInfo extends AppCompatActivity {
  
  
      TextView nameOfUserEntered, usernameEntered, passwordEntered,gmailEntered, genderSelected, courseSelected, dateOFJoinSelected, timeOfJoinSelected;
  
  
      Button signInButtonAgain;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_show_info);
  
          Bundle getValue = getIntent().getExtras();
          String getnameentered = getValue.getString("enteredname");
          String getenteredGmail = getValue.getString("enteredgmail");
          String getenteredUsername = getValue.getString("enteredusername");
          String getenteredPassword = getValue.getString("enteredpassword");
          String getdateSelected = getValue.getString("dateselected");
          String gettimeSelected = getValue.getString("timeselected");
          String getgenderSelected = getValue.getString("genderselected");
          String getcourseSelected = getValue.getString("courseselected");
  
  
          nameOfUserEntered = findViewById(R.id.nameofuserentered);
          usernameEntered = findViewById(R.id.usernameentered);
          passwordEntered = findViewById(R.id.passwordentered);
          gmailEntered = findViewById(R.id.gmailentered);
          genderSelected = findViewById(R.id.genderselected);
          courseSelected = findViewById(R.id.courseselected);
          dateOFJoinSelected = findViewById(R.id.dateofjoinselected);
          timeOfJoinSelected = findViewById(R.id.timeofjoinselected);
          signInButtonAgain = findViewById(R.id.signinbuttonagain);
  
          nameOfUserEntered.setText("Welcome "+ getnameentered);
          usernameEntered.setText("Your username is "+getenteredUsername);
          passwordEntered.setText("Your password is "+getenteredPassword);
          gmailEntered.setText("Your gmail is "+getenteredGmail);
          genderSelected.setText("Your gender is the "+getgenderSelected);
          courseSelected.setText("You selected for the "+getcourseSelected+" Course");
          dateOFJoinSelected.setText("your joinig date is "+getdateSelected);
          timeOfJoinSelected.setText("Time of your duty is starts from "+gettimeSelected);
  
          signInButtonAgain.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  Intent gotoMainmenu = new Intent(ShowInfo.this, MainActivity.class);
                  startActivity(gotoMainmenu);
              }
          });
  
  
      }
  }
  </code></pre>
  
  <p>In registration activity I've added a comment by only that code my app show the error message. If I remove the <code>radiobutton</code> code and the <code>getString</code> String. It works properly and then it doesn't show app stopped working message.
  So why I'm not able to pass the value of the <code>radiobutton</code> string from one activity to another.</p>