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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:58:48+00:00 2026-05-18T10:58:48+00:00

:) My RadioGroup’s RadioButtons get dynamically created from an ArrayList (which resides in my

  • 0

🙂 My RadioGroup’s RadioButtons get dynamically created from an ArrayList (which resides in my main activity) full of links like so:

ArrayList = { “hxxp://helloworld.com”, “hxxp://helloworld2.net”, …, “hxxp://whatever.com” }

then I have a new class called “links” that gets called from a menu button in my main activity which sets a nice layout with a radiobubtton per link (in a scrollview) and a “go!” button on the bottom of the page (relative layout).

This all works great except for one thing. If you exit the application using the back button, and go back into the application by clicking on the icon in the Android menu, you get to the main activity, then click the “links” button in the menu and they are doubled each time. ??? like so:

link 0
link 1
link 2
link 0 (again)
link 1 (again)
link 2 (again)

This appends the links to the bottom each time you come back to the “links” activity from leaving. Is there some way I can call a method to clear all radio buttons generated form the last session in the links activity before putting them into the RadioGroup? I tried changing my onPause() to finish(); I tried freeing the cache with RadioGroup.destroyDrawingCache(); nothing seems to do it.

  • 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-18T10:58:48+00:00Added an answer on May 18, 2026 at 10:58 am

    Instead of this ‘delete everything’ approach (which is surely possible) I would try something different – place a breakpoint in the code that firstly populates your radio buttons and press the back button, then go back into the app, then again back, again back into the app, etc.

    If the breakpoint gets hit each time you switch back into the application, then there is your problem. Fix it by moving that code from where it is to OnCreate for example, so it is only called once at Activity creation time. If that is not doable, then use some class variable like ‘boolean mRadioButtonsPopulated’ which gets checked just before the radio buttons population code, and gets set to true after the (first) radio button population happened.

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

Sidebar

Related Questions

I have a ListView, which has a TextView and a RadioGroup with 4 RadioButtons
How can i retrieve the text of a dynamically created radio button selected by
I have a RadioGroup and two RadioButtonField added in a VerticalFieldManager. I want put
The code is : $(#radioGroup).click(function() { $(#groupSpan).css(display, block); $(#advisorSpan).css(display, none); }); and for second
How do you load data for a radiogroup in extjs, such that the correct
I'd like to set RadioButton properties in runtime in procedure InitRadioGroup(). It fails because
I am having some difficulty accessing the value of the selected radio button in
I am trying to create a screen with some dynamic controls, well radio buttons
I am using strong typed views in my MVC and have now manage to
What I'm trying to accomplish: When the user clicks a specific RadioButton, a TextView

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.