In my android studio, I have used 3 radio buttons, 1 button and 1 spinner. The output should work in a way that if one button is clicked, then the spinner should show 3 different options, and the same has to be repeated with the other buttons too. For each button, a different set of options should be available in the spinner. After the choice has been selected, and after the button is clicked, it should display the text of the selected radio button, and the text of the option selected on the spinner.
I have tried many ways to link the radio buttons and spinner, but it has not worked. If anyone can help fix my problem and give the code on how to fix this problem, it would be much appreciated.
I have tried so many times, and every time an error occurs, or it doesn't run the way it should. So if anyone knows how to fix the problem, please do help.
This is the code written in "arrays" file.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="default_options">
<item> Default Option1 </item>
<item> Default Option2 </item>
<item> Default Option3 </item>
</string-array>
<string-array name="radioOption1" >
<item> Option1.1 </item>
<item> Option1.2 </item>
<item> Option1.3 </item>
</string-array>
<string-array name="radioOption2" >
<item> Option2.1 </item>
<item> Option2.2 </item>
<item> Option2.3 </item>
</string-array>
<string-array name="radioOption3" >
<item> Option3.1 </item>
<item> Option3.2 </item>
<item> Option3.3 </item>
</string-array>
</resources>
In the "main activity file", I have implemented the "Array Adapter". But still the spinner does not show any options when the device is launched.