how can i send radio button value and switch case option to server using json android?

后端 未结 4 1686
忘了有多久
忘了有多久 2021-01-29 10:07

I\'m trying to make a registration form where all values are saving on the server, but i dont know how to send the radio buttons\' value and switch option buttons\' value to ser

4条回答
  •  别那么骄傲
    2021-01-29 10:53

    try this out incase of radio button it works for me.

    radio_button_value1 = ((RadioButton) findViewById(radioGroup1.getCheckedRadioButtonId())).getText().toString();
    

    above code is to get value of the radio button.

    replace your this code

    // get selected radio button from radioGroup
            int selectedId = rgrp.getCheckedRadioButtonId();
    

    with this code and test

    // get selected radio button from radioGroup
     int selectedId = rgrp.getCheckedRadioButtonId().getText().toString();
    

    hope this updated code helps you.you just have to replace and check

提交回复
热议问题