Skip to content Skip to sidebar Skip to footer

How To Send Data To New Android Activity

I am working on an application that gathers user selection (from a checkbox) and sends it to a new activity (when a button is pressed ). In the new activity, a new data will be col

Solution 1:

RadioGroup radioGroup = (RadioGroup) this
            .findViewById(R.id.radio_group);
    radioGroup
            .setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

                @Override
                public void onCheckedChanged(RadioGroup radioGroup, int id) {
                    final RadioButton radioButton = (RadioButton) radioGroup
                            .findViewById(id);

                    String selectedText = radioButton.getText().toString();
                    Intent i = new Intent(this, PersonData.class);
                    i.putExtra("cakedata", selectedText);
                    startActivity(i);
                }

            });

Post a Comment for "How To Send Data To New Android Activity"