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

  • Home
  • SEARCH
  • 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 9134483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:40:07+00:00 2026-06-17T08:40:07+00:00

I am trying to build a radio button input activity. I have done whatever

  • 0

I am trying to build a radio button input activity. I have done whatever described in
http://developer.android.com/guide/topics/ui/controls/radiobutton.html

But I am getting “RadioButton cannot be resolved to a type” error in
boolean checked = ((RadioButton) view).isChecked(); line. I am getting Red line under “((RadioButton) view)” part. What I am missing? Please help.

 package com.my.test;

    import android.os.Bundle;
    import android.app.Activity;
    import android.content.Intent;
    import android.view.Menu;
    import android.view.View;
    import android.widget.EditText;

    public class Main1 extends Activity {


        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main1);
        }

        public void onRadioButtonClicked(View view) {
            // Is the button now checked?
            boolean checked = ((RadioButton) view).isChecked();
            int a; // store the value corresponding to  the RadioButton which is clicked 

               switch(view.getId()) {
                            case R.id.radio1:
                                if (checked)
                                 a = 3;
                                    break;
                            case R.id.radio2:
                                if (checked) a = 2;
                                    break;
                            case R.id.radio3:
                                if (checked) a = 1;
                                    break;
                            case R.id.radio4:
                                if (checked) a = 0;
                                    break;
                     }

               Intent intent = new Intent(this, Test2.class);
               intent.putExtra("inputValue", a); // pass "a" to the next Activity       

    }
        }
  • 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-17T08:40:08+00:00Added an answer on June 17, 2026 at 8:40 am

    Add the following line to the top of your class, along with the other imports:

    import android.widget.RadioButton;
    

    For future reference, you can automatically have Eclipse add the imports by pressing ctrl-shift-O (Windows) or command-shift-O (Mac)

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

Sidebar

Related Questions

I'm trying build a excel based input form, I have found something online and
I am trying to build a custom toggle button in Android, I want it
I am trying to build RadioGroup in Android with one RadioButton checked by default.
I'm trying build an App Engine connected Android application and am having some problems
I have a std::vector< tr1::shared_ptr<mapObject> > that I'm trying build from data contained in
Trying to build my android project with Buildr (Apache), but can't find any info
I have a small problem when trying build an XML document with Nokogiri. I
Trying to build Android open source project on Ubuntu 10.04 (on VMware Player). I
Im trying to build a directory called images on the SD card on android.
I'm trying to build a list of radio buttons with labels so that you

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.