Replacing images with text when a radio button is clicked.

  • Replies:1
  • OpenNot stickiedUnanswered
  • Forum posts: 15

Sep 10, 2015 8:15:33 AM via Website

I am a beginner in android development. I am trying to develop an application & as a test run it is a Q&A app. I am facing an issue while creating pages, as the pages have 2 radio buttons in a radio group, the center of the page has an image, and have few buttons(Next, Previous, Home) at the bottom. I want a functionality that, whenever a user clicks on a radio button the image needs to disappear and the answer (Text) needs to appear in a scroll text box. The app is Yes/No based so when either button is clicked the image need to disappear and text needs to replace it. I searched few android developer forum communities look for a genuine solution, hoping a satisfactory solution form this platform.
Thanks in Advance

  • Forum posts: 207

Sep 10, 2015 2:23:33 PM via Website

For Checking which radio button is clicked you can use the code

RadioGroup radioGroup = (RadioGroup) findViewById(;
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener()
public void onCheckedChanged(RadioGroup group, int checkedId) {
// checkedId is the id of selected radio button id.(You can also compare the id)
use you imageview and textview object which you are using in findViewbyID() method.
Hope it work. If still issue let us know