title: Using the ToggleButton to send data to another activity on Button Click
body: <p>I am working on a project where I want a group of togglebuttons to send data to another activity in android.</p>
  
  <p>I want the togglebuttons to send data to another activity based on the ones that are clicked. Here's the xml:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_start2"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.brillica.vapid.Start2"&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Example"
      android:textSize="20sp"
      android:textColor="#000"
      android:layout_alignParentTop="true"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="19dp"
      android:id="@+id/question" /&gt;
  
  &lt;ToggleButton
      android:textOff="Sports"
      android:textOn="Sports"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="88dp"
      android:id="@+id/sports"
      android:layout_below="@+id/question"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:textColor="#fff"
      android:background="#DDA388"/&gt;
  
  &lt;ToggleButton
      android:textOff="Science"
      android:textOn="Science"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/science"
      android:textColor="#fff"
      android:background="#DDA388"
      android:layout_alignBaseline="@+id/sports"
      android:layout_alignBottom="@+id/sports"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true" /&gt;
  
  &lt;ToggleButton
      android:textOff="Art"
      android:textOn="Art"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/art"
      android:textColor="#fff"
      android:background="#DDA388"
      android:layout_alignBaseline="@+id/science"
      android:layout_alignBottom="@+id/science"
      android:layout_centerHorizontal="true" /&gt;
  
  &lt;ToggleButton
      android:textOff="Entertainment"
      android:textOn="Entertainment"
      android:layout_width="120dp"
      android:layout_height="wrap_content"
      android:id="@+id/entertainment"
      android:textColor="#fff"
      android:background="#DDA388"
      android:layout_centerVertical="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true" /&gt;
  
  &lt;ToggleButton
      android:textOff="Crafting"
      android:textOn="Crafting"
      android:layout_width="120dp"
      android:layout_height="wrap_content"
      android:id="@+id/reading"
      android:textColor="#fff"
      android:background="#DDA388"
      android:layout_alignBaseline="@+id/entertainment"
      android:layout_alignBottom="@+id/entertainment"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true" /&gt;
  
  &lt;ToggleButton
      android:textOff="Farming"
      android:textOn="Farming"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/farming"
      android:textColor="#fff"
      android:background="#DDA388"
      android:layout_alignBaseline="@+id/reading"
      android:layout_alignBottom="@+id/reading"
      android:layout_alignLeft="@+id/art"
      android:layout_alignStart="@+id/art" /&gt;
  
  
  &lt;Button
      android:layout_width="150dp"
      android:layout_height="wrap_content"
      android:layout_marginTop="65dp"
      android:id="@+id/next"
      android:background="#DDA388"
      android:text="Continue"
      android:textColor="#fff"
      android:onClick="next"
      android:layout_below="@+id/entertainment"
      android:layout_centerHorizontal="true" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>If for example togglebutton science and togglebutton art are clicked, I want text in another activity to change to "Art and Science" once button next is clicked, and if art is clicked alone, I want the TextView to display Art once button next is clicked.</p>
  
  <p>I am new to programming so I am not that experienced with code.</p>
  
  <p>Any ideas? </p>