Trying to access a new activity by selecting RadioButton in Android Studio

I have a radioGroup with 3 radioButtons. Once you select a radio button it should take you to another activity and access a specific fragment within that second activity. I have no compile or runtime errors. The issue: you can select radioButton but nothing happens. I am new to android studios and java. I would appreciate any help. Most questions are using a button to access a new activity not a radio button.

package com.example.joseph.ex51_twoactivities;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;

public class MainActivity extends Activity implements View.OnClickListener {
    //EditText etMessage;
    RadioButton profOne;
    RadioButton profTwo;
    RadioButton profThree;

    protected void onCreate(Bundle savedInstanceState) {
       //etMessage = (EditText)findViewById(;
       profOne = (RadioButton)findViewById(;
       profTwo = (RadioButton)findViewById(;
       profThree = (RadioButton)findViewById(;
       if(profOne.isChecked()) {
       if(profTwo.isChecked()) {
       if(profThree.isChecked()) {


I figured it out, I shouldn’t have a conditional statement under the onCreate method.

Leave a Reply

Your email address will not be published. Required fields are marked *