Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8877007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:21:37+00:00 2026-06-14T19:21:37+00:00

quick question. How would I go about to pass a checked radio button value

  • 0

quick question. How would I go about to pass a checked radio button value to other activities using intent? Do I need to also use sharing preference to save the value?

I wanted to do something like “when user selected the radio button (for example: red,blue,green, yellow) and all the textview’s color will be changed on all activities.

public class Text_Colour extends Activity implements RadioGroup.OnCheckedChangeListener {

RadioButton rb1, rb2, rb3, rb4;
TextView tv2;
RadioGroup rg1;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.colours);

    tv2 = (TextView)findViewById(R.id.textview2);
    rb1 = (RadioButton) findViewById(R.id.radioButton1);
    rb2 = (RadioButton) findViewById(R.id.radioButton2);
    rb3 = (RadioButton) findViewById(R.id.radioButton3);
    rb4 = (RadioButton) findViewById(R.id.radioButton4);
    rg1 = (RadioGroup) findViewById(R.id.radiogroup1);
    rg1.setOnCheckedChangeListener(this);

}

public void onCheckedChanged(RadioGroup rg1, int r) {

    // TODO Auto-generated method stub
    if (r==rb1.getId()) {
        tv2.setTextColor(Color.RED); 
    } 
    if (r==rb2.getId()) {
        tv2.setTextColor(Color.YELLOW); 
    } 
    if (r==rb3.getId()) {
        tv2.setTextColor(Color.GREEN); 
    } 
    if (r==rb4.getId()) {
        tv2.setTextColor(Color.BLUE); 
    } 

    else {
        tv2.setTextColor(Color.BLACK);
    }

}

}

thanks for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T19:21:38+00:00Added an answer on June 14, 2026 at 7:21 pm

    If you are talking about one application and activities within it, then I would suggest to go with SharedPreferences.
    Here is what you need to do:

    1. When the radiobutton value is changed, save it in shared preferences.
    2. Make all your activities to listen for changes in SharedPreferences. In this case, as soon as you change a color, all running activities will be notified so they will update their UI. Just use SharedPreferences.registerOnSharedPreferenceChangeListener() method.
    3. onCreate of every activity needs to read the color value from shared preferences and do necessary UI work.
      Done!
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quick question about how you would go about implementing this. I want
Have a quick question about what would be the best way to implement iterators
Had a quick question about Sphinx Search installation. Do I need to install it
Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm
I have a quick question about HTML and CSS. I thought this would be
Quick question. How would I go about displaying comments to a static page from
I have quick question about tkinter Python. I created Button added command to execute
quick question about using ORMLite. I am trying to make sure that my implementation
I just have a quick question about how you would typically approach this. I
Good day, just a quick question: I would like to bind a table to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.