title: Android How do display array contents to textview?
body: <p>How do I loop around contents of an array and display line by line on a text view</p>
  
  <p>java code</p>
  
  <pre><code>package com.stuff;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.provider.UserDictionary;
  import android.text.Spannable;
  import android.text.SpannableStringBuilder;
  import android.text.style.ClickableSpan;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ProgressBar;
  import android.widget.TextView;
  
  public class ScrumActivity extends Activity 
  {
      TextView textout;
      EditText inputBox;
      Button okButton;
      ProgressBar progressBar;
      Scrumer scrumbler = new Scrumer();
      StringBuilder sb = new StringBuilder();
  
      @Override
      public void onCreate(Bundle savedInstanceState) 
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          //Get elements from XML to use in application
          textout = (TextView) findViewById(R.id.textView1);
          inputBox = (EditText) findViewById(R.id.inputBox);
          okButton = (Button) findViewById(R.id.button1);
          progressBar = (ProgressBar) findViewById(R.id.progressBar1);
          //progressBar.setVisibility(View.VISIBLE);
  
  
          SpannableStringBuilder sb = new SpannableStringBuilder();
          String regularText = "This text is ";
          String clickableText = "clickable";
          sb.append(regularText);
          sb.append(clickableText);
          sb.setSpan(new ClickableSpan(), sb.length()-clickableText.length(), sb.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
          //tv.setText(sb);
  
  
  
  
          //setting a listener for the button to be clicked
          okButton.setOnClickListener(new View.OnClickListener() 
          {
              @Override
              public void onClick(View v) 
              {
                  //textout.setText(inputBox.getText().toString());
                  scrumer.jumble(inputBox.getText().toString());
  
  
                  for(String s : scrumbler.getMatchArray())
                      sb.append(s+"\n");
  
                  textout.setText("ok");
  
                  System.out.print(sb.toString());
              }
          });     
      }    
  }
  </code></pre>
  
  <p>Heres my main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:gravity="center_horizontal"
      android:orientation="vertical" &gt;
  
      &lt;EditText
          android:id="@+id/inputBox"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:ems="10" &gt;
          &lt;requestFocus /&gt;
      &lt;/EditText&gt;
  
      &lt;Button
          android:id="@+id/button1"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Search" /&gt;
  
      &lt;TextView
          android:id="@+id/textView1"
          android:layout_width="184dp"
          android:layout_height="wrap_content"/&gt;
  
      &lt;ProgressBar
          android:id="@+id/progressBar1"
          style="?android:attr/progressBarStyleLarge"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>