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 9227845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:10:49+00:00 2026-06-18T05:10:49+00:00

I Want to display values according to my checkbox status.. The Code I Have

  • 0

I Want to display values according to my checkbox status..

The Code I Have Used Is..

if((cb1).isChecked()==true){
        str="abc";
    }



    public void chk_med(View view){
    Intent intent = new Intent(Medicine.this, chk_med.class);
    Medicine.this.startActivity(intent);
    intent.putExtra("fvr", str);

Code For chk_med

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.disp_med);
    Bundle extras=getIntent().getExtras();
    String Value1;
    Value1 = extras.getString("fvr");



    TextView t1 = (TextView)findViewById(R.id.show_res);
    t1.setText(Value1);

}

what seems to be the error?
Plz help guyz.

I Changed the code to

public void chk_med(View view){
    Intent intent = new Intent(Medicine.this, chk_med.class);
    intent.putExtra("fvr", a);
    Medicine.this.startActivity(intent);

but still it displays nothing in chk_med intent

  • 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-18T05:10:51+00:00Added an answer on June 18, 2026 at 5:10 am

    You’re giving the extra to the Intent after starting the new Activity. Therfore, once you launch that new Activity, you never actually get the extra you wanted.

    This means you should change your code so it is:

     public void chk_med(View view){
        if(cb1.isChecked())
           str="abc";
        else
           str = "xyz";
        Intent intent = new Intent(Medicine.this, chk_med.class);
        intent.putExtra("fvr", str);
        Medicine.this.startActivity(intent);
    }
    

    This allows the extra to be given to the Intent at the right time.

    Also consider proper Java naming conventions: Classes start with capitals, and variables don’t (camelcase).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display three different values allocated to two different headers, in other
I want to display all the possible enum values as Radio buttons. I am
I want to display different forms in change_form depending on some model field's values.
I want to display digits with leading 0s, for values of a single digit,
I want to be able to display links based on cell values. So if
I have a report in which I want to display value of 2 engineers
i want to get 'display' css value of a server side div! the code
According to http://msdn.microsoft.com/en-us/library/6t7dwaa5.aspx , if I want to display a number as a currency,
I have this data as displayed in images. And I want to display this
I want to display the photos according to the album selected. But, I don't

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.