title: Set TextView text with a for loop so multiple lines show
body: <p>So I have a for loop that I want to output a new line in a textview every single time it goes through. However, I am not sure if that is possible. I have TableLayout in there but it put the items vertically instead of horizontally. I thought about ListView but not sure how to set the text of it.</p>
  
  <p>Here is my code</p>
  
  <pre><code>    import android.app.Fragment;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TableLayout;
  import android.widget.TableRow;
  import android.widget.TextView;
  
  import com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route;
  
  import org.joda.time.DateTime;
  import org.w3c.dom.Text;
  
  import java.io.IOException;
  import java.util.Map;
  
  import okhttp3.Request;
  import okhttp3.Response;
  
  
  /**
   * Created by James Singleton on 8/13/2016.
   */
  
  public class WeeklyDrives extends Fragment implements APIRequestsUtil.APIRequestResponseListener
  {
      View myView;
      Map&lt;String, Route&gt; drives;
      private TextView driveNumber;
      private TextView driveDistance;
      private TextView driveTime;
      private TextView driveNumList;
      private TextView driveDistList;
      private TextView driveTimeList;
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          myView = inflater.inflate(R.layout.weekly_drives, container, false);
          APIRequestsUtil.setOnNetWorkListener(this);
  
          return myView;
      }
  
  
      private void populateView() {
          this.getActivity().runOnUiThread(new Runnable() {
              @Override
              public void run() {
                  drives = APIRequestsUtil.getRoutes();
  
                  driveNumber = (TextView) myView.findViewById(R.id.Drive_Number);
                  driveDistance = (TextView) myView.findViewById(R.id.Drive_Distance);
                  driveTime = (TextView) myView.findViewById(R.id.Drive_Time);
  
                  driveNumber.setText("Drive Num.");
                  driveDistance.setText("Distance");
                  driveTime.setText("Time");
                  int driveNum = 0;
                  for (Map.Entry drive : drives.entrySet()) {
                      TableRow tr = new TableRow(getActivity());
                      Route route = (Route) drive.getValue();
                      tr.setId(driveNum++);
                      //tr.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  
                      DateTime startTime = new DateTime(route.getStart_time());
                      DateTime endTime = new DateTime(route.getEnd_time());
  
  
                      driveNumList = (TextView) myView.findViewById(R.id.Drive_Number_List);
                      driveDistList = (TextView) myView.findViewById(R.id.Drive_Distance_List);
                      driveTimeList = (TextView) myView.findViewById(R.id.Drive_Time_List);
  
                      driveNumList.setText(driveNumList.getText().toString() + String.valueOf(driveNum) + System.getProperty("line.separator"));
                      driveDistList.setText(driveDistList.getText().toString() + Float.parseFloat(route.getLen()) / 1000 + " km" + System.getProperty("line.separator"));
                      driveTimeList.setText(driveTimeList.getText().toString() + ((endTime.getMillis() - startTime.getMillis())/ 1000)/60 + " min" + System.getProperty("line.separator"));
                  }
              }
          });
  
      }
  
      @Override
      public void onFailure(Request request, Throwable throwable) {
  
      }
  
      @Override
      public void onResponse(Response response) {
          populateView();
      }
  }
  </code></pre>
  
  <p>Here is my XML:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;!--Header aligned to top --&gt;
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:id="@+id/header"
          android:gravity="center"
          android:background="#FC9"&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/Drive_Number"
              android:layout_margin="4dp"
              android:textSize="20sp"
              android:textColor="#000"/&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/Drive_Distance"
              android:layout_toRightOf="@+id/Drive_Number"
              android:layout_margin="4dp"
              android:textSize="20sp"
              android:textColor="#000"/&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/Drive_Time"
              android:layout_toRightOf="@+id/Drive_Distance"
              android:layout_margin="4dp"
              android:textSize="20sp"
              android:textColor="#000"/&gt;
      &lt;/RelativeLayout&gt;
      &lt;ScrollView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:scrollbars="vertical"
          android:background="#005"
          android:layout_below="@+id/header"
          android:id="@+id/scrollableContents"&gt;
  
          &lt;!--&lt;TableLayout--&gt;
              &lt;!--android:id="@+id/fragment1_tlayout"--&gt;
              &lt;!--android:layout_width="wrap_content"--&gt;
              &lt;!--android:layout_height="wrap_content"--&gt;
              &lt;!--android:stretchColumns="0,1"&gt;--&gt;
  
          &lt;!--&lt;/TableLayout&gt;--&gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:gravity="center"
              android:orientation="horizontal"&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/Drive_Number_List"
              android:layout_margin="4dp"
              android:textSize="20sp"
              android:textColor="#CCCCCC" /&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/Drive_Distance_List"
              android:layout_toRightOf="@+id/Drive_Number_List"
              android:layout_margin="4dp"
              android:textSize="20sp"
              android:textColor="#CCCCCC"/&gt;
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:id="@+id/Drive_Time_List"
              android:layout_toRightOf="@+id/Drive_Distance_List"
              android:layout_margin="4dp"
              android:textSize="20sp"
              android:textColor="#CCCCCC"/&gt;
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p><code>drive.entrySet()</code> output</p>
  
  <pre><code>What is this:[2016-07-11--08-52-18=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@12a862, 2016-07-11--09-37-46=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@50bbdf3, 2016-07-11--18-54-22=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@6d21ab0, 2016-07-12--09-15-59=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@fb72d29, 2016-07-12--09-29-29=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@776e8ae, 2016-07-12--09-33-03=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@d1a464f, 2016-07-12--09-38-56=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@5b631dc, 2016-07-12--09-41-08=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@dec72e5, 2016-07-12--09-42-39=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@acce1ba, 2016-07-12--09-44-33=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@5def86b, 2016-07-12--09-49-31=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@d628fc8, 2016-07-12--09-54-06=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@7765861, 2016-07-12--19-04-34=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@8575f86, 2016-07-12--19-39-20=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@3f2b047, 2016-07-12--19-40-27=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@df4e074, 2016-07-12--19-41-28=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@b5f199d, 2016-07-13--08-45-17=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@db9ee12, 2016-07-13--09-01-32=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@2a009e3, 2016-07-13--15-02-04=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@9b98fe0, 2016-07-14--08-46-22=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@518b299, 2016-07-14--19-22-46=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@d44d95e, 2016-07-14--19-34-02=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@d3f613f, 2016-07-14--20-16-47=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@957ca0c, 2016-07-15--08-36-28=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@b38df55, 2016-07-15--09-52-32=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@c012d6a, 2016-07-15--12-09-57=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@252d25b, 2016-07-15--12-15-07=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@6bd7af8, 2016-07-15--15-36-10=com.example.jamessingleton.chffrapi.com.examples.jamessingleton.chffrapi.data.Route@df51bd1,
  </code></pre>