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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:02:35+00:00 2026-05-26T03:02:35+00:00

I have a scenario that we should have a single choice mode radio button

  • 0

I have a scenario that we should have a single choice mode radio button in listview. when i am click on the radiobutton it should go to enable state. when i am click on the whole item then it should redirect to the new activity. i refered below link

link1 , link2

i can find out the way for multiple choice mode. but not for the single choice mode. Any Idea on this ?

???Edit???
How can i find the tag of the corresponding tag of an item in the listview

  • 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-26T03:02:36+00:00Added an answer on May 26, 2026 at 3:02 am

    One way you can but I don’t know it’s perfect or not.

    track the position id of the listview on which the radio button was checked now when you click on the another radio button then implement the setOnCheckedChangeListener(listener) and check the position which was already check and uncheck that radiobutton.

    You can store the status of radio button into the custom model(Model which contains the controls like textview, imageview, radiobutton etc for listview single row) which was added into the listview

    check this article for using model and handle the component into the listview in this given an example of checkbox

    Update

    I think you can get tag like this way

    ((View)((ViewGroup)listview.getItemAtPosition(0)).getTag()).getTag();
    or
    ((Button)l.getItemAtPosition(0)).getTag();
    

    update 2

    suppose this is your adapter and arraylist object

    private List<Model> list_model = new ArrayList<Model>();
    
    private ArrayAdapter<Model> modelAdapter;
    

    you Model class look like this

    private class Model{
        private String text1 = "";
        private boolean isChecked   = false;
    
        public Model(String text1){
            this.text1 = text1;
            isChecked = false;
        }
    }
    

    your viewholder

    private static class ViewHolder{
        TextView textView;
            RadioButton radioBtn;
    }
    

    pass the listmodel to this CustomAdapter class in constructor

    private List<Model> list;
    private Context context;
    
    public CustomAdapter(Context context, List<Model> list){
        super(context,R.layout.list_layout,list);
        this.list = list;
        this.context = context;
    }
    

    now in getView()

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = null;
    
        if(convertView == null){
            LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            view = inflater.inflate(R.layout.gcalendar_list_layout, null);
            final ViewHolder viewHolder = new ViewHolder();
            viewHolder.textView = (TextView) view.findViewById(R.id.text1);
            viewHolder.radioBtn = (RadioButton) view.findViewById(R.id.radioBtn);
            viewHolder.radioBtn.setOnCheckedChangeListener(new OnCheckedChangeListener() {
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    Model element = (Model) viewHolder.checkBox.getTag();
                    element.isChecked = buttonView.isChecked();
                    boolean isChecked = true;
                    for(int i=0;i<list.size();i++){
                        if(!list.get(i).isChecked){
                            list.get(i).isChecked=false; // more implement here or may be this work
                            break;
                        }
                    }
                }
            });
            view.setTag(viewHolder);
            viewHolder.radioBtn.setTag(list.get(position));
        }else{
            view = convertView;
            ((ViewHolder)view.getTag()).radioBtn.setTag(list.get(position));
        }
        ViewHolder holder = (ViewHolder) view.getTag();
        holder.textView.setText(list.get(position).name);
        holder.radioBtn.setChecked(list.get(position).isChecked);
        return view;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario: You have an ASP.Net webpage that should display the next image in a
scenario: I have difficulty in building a single query that would display a report
We have 18 databases that should have identical schemas, but don't. In certain scenarios,
I have a path defined: when /the admin home\s?page/ /admin/ I have scenario that
I have a scenario that my load balancer translates port 80 from outside into
I have a scenario that I haven't been able to solve: I'm toying around
I have a scenario that, I am creating dynamic html content and I need
I have a scenario that when I try to access a hash key using
I have a scenario outline table that looks like the following: Scenario Outline: Verify
Here is the scenario that I have. I have a cvs repository in one

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.