Oriol Lopez
Oriol Lopez

Reputation: 369

How to check RadioButton of other Activity

How I can check one RadioButton of other Activity in Android?

I'm trying it with normal sentence but my app crash.

Upvotes: 1

Views: 59

Answers (2)

SuperFrog
SuperFrog

Reputation: 7674

You should use Intent extras. Just pass the value of the RadioButton to the next Activity:

    Intent nextActivtyIntent = new Intent(FirstActivity.this, SecondActivity.class);
    nextActivtyIntent.putExtra("RadioButtonValue", "value");
    startActivity(nextActivtyIntent);

Then in SecondActivity you can get this value:

     String radioButtonValue = getIntent().getExtras().getString("RadioButtonValue");

You can offcourse pass an Int (and other types as well) the same way, use whatever suits you best.

Read this for further info: Android Bundle

Upvotes: 1

Brad Chou
Brad Chou

Reputation: 71

Have you tried this function?

public void setChecked (boolean checked)

http://developer.android.com/reference/android/widget/CompoundButton.html#setChecked(boolean)

Upvotes: 0

Related Questions