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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:39:59+00:00 2026-05-27T06:39:59+00:00

OK, I am very new to Android and C#. Just started today in fact.

  • 0

OK, I am very new to Android and C#. Just started today in fact. I normally program in VB, but anyway I was trying MonoDroid out and after a couple of small tutorials I tried something on my own. What I want is that there are two radio buttons on the canvas. And a disabled button, it only gets enabled when you click on one of the radio buttons. Funnily, you have to code the radio buttons to uncheck when the other one is clicked unlike in windows forms, or I’m missing someting. But I managed that. And when you press the button ‘Next’ it goes to the next page.

This is my code for the above:

    protected override void OnCreate(Bundle bundle)
    {

        base.OnCreate(bundle);
        // Set our view from the "main" layout resource
        SetContentView(Resource.Layout.Main);
        RadioButton radSilent1 = FindViewById<RadioButton>(Resource.Id.radSilent);
        RadioButton radVibrate1 = FindViewById<RadioButton>(Resource.Id.radVibrate);
        Button button1 = FindViewById<Button>(Resource.Id.btnNext);
        radSilent1.Click += delegate
        {
            button1.Enabled = true;
            if (radSilent1.Checked == true)
                radVibrate1.Checked = false;
            else if (radVibrate1.Checked == true)
                radSilent1.Checked = false;
            {
            }
        };
        radVibrate1.Click += delegate
        {
            button1.Enabled = true;
            if (radVibrate1.Checked == true)
                radSilent1.Checked = false;
            else if (radSilent1.Checked == true)
                radVibrate1.Checked = false;
            {
            }
        };
        // Set our view from the "secondry" layout resource
        button1.Click += delegate { SetContentView(Resource.Layout.Secondry); };
    }

This brings up the second canvas. Where I have another button ‘Back’. When I press that button it brings me to the first screen but the above code doesn’t work. I press the two radio buttons and both are checked, and the button doesn’t enable either. Why does this happen? Remember I am very new to this sorry. lol
Any help is much appreciated.

Thanks.

  • 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-05-27T06:39:59+00:00Added an answer on May 27, 2026 at 6:39 am

    The error is that when you have used new layout (SetContentView(Resource.Layout.Secondry)) you have lost all attached event handlers that was initialized in OnCreate(Bundle bundle). To solve this problem you need to create 2 methods something like InitializeMainView() and InitializeSecondView() where attach handlers to controls events on selected layout. And after changing layout you just call init method for selected view.

    But i think that the best solution will be to create new separate activity for second view.

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

Sidebar

Related Questions

I'm very new to Android development and just started to study. What I'm trying
I'm very new to Android development (just started today), and also very new to
I've just started android learning recently, and I'm trying to write one program, but
I'm still very new to Android, but I am trying to keep up by
Im very new to this android development.I just started to create a hello world
I'm very new to android, in fact only started yesterday. I managed to get
I've just started out building a very simple score screen for my app but
I am very new to Android application development. Just started Hello world android application
Ok so I am very new to android and I am just trying to
I'm very new to Android programming and I've been trying to figure out why

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.