-5

I am doing code for an app i am working on. There will be registration form and that user itself can check that job detail in user job detail.

my problem here i can get or pull the check box input to the user job detail page to view it. If the user checked "chilled deliver" it must say it is chilled deliver in the user job detail else it will say "it is not chilled deliver".

abiramy
  • 33
  • 1
  • 4
  • 4
    Show us what have you tried? At least try to search around, there are plenty of examples/resources available. – Paresh Mayani Aug 20 '15 at 10:01
  • possible duplicate of [Android getting value from selected radiobutton](http://stackoverflow.com/questions/18179124/android-getting-value-from-selected-radiobutton) – Sipty Aug 20 '15 at 10:13

1 Answers1

1

What you should do is in your xml:

 <RadioGroup
                android:id="@+id/radio_chilled"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <RadioButton
                    android:id="@+id/radio_chilled"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:checked="true"
                    android:text="true"
                  />

                <RadioButton
                    android:id="@+id/radio_not_chilleed"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="false"/>

            </RadioGroup>

and then you create a function to retrive the selected value :

private RadioGroup chilledGroup;
public void setChilledFromView()
    {
        int selectedId = chilledGroup.getCheckedRadioButtonId();
        chilledRadioBtn = (RadioButton) getView().findViewById(selectedId);
        isChilled = chilledRadioBtn.getText().toString();

        if (gender.equals("true")) {
            isChilled = "chilled deliver";
        } else if (gender.equals("false") {
            isChilled = "it is not chilled deliver";
        }
    }
Ahmed Abidi
  • 1,047
  • 12
  • 24