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

后端 未结 4 1753
忘了有多久
忘了有多久 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:59

    you can get the value of checked radio button from OnCheckedChangedListener

    rgrp.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener()
        {
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                // checkedId is the RadioButton selected
                RadioButton rb=(RadioButton)findViewById(checkedId);
                Toast.makeText(getApplicationContext(), rb.getText(), Toast.LENGTH_SHORT).show();
            }
        });
    

提交回复
热议问题