title: Android TableLayout with over 1000 rows loading very slowly
body: <p>I'm looking for a way to speed up the creation of a TableLayout with over 1000 rows. Is there a way to create a TableLayout entirely on a separate thread or a way to speed it up?</p>
  
  <p>Here is my method that is creating the table:</p>
  
  <pre><code>private void setTable()
  {       
      final Activity activity = this;
  
      final Handler handler = new Handler();
  
      new Thread(new Runnable()
      {
          @Override
          public void run() 
          {
              for (int x = 0; x &lt; rooms.size(); x++)
              {
                  final int inx = x;
                  handler.post(new Runnable()
                  {
                      @Override
                      public void run() 
                      {
                          Methods.createRow(table, rooms.get(inx), null, activity);
                          TableRow row = (TableRow)table.getChildAt(inx);
                          row.setOnClickListener(new OnClickListener()
                          {
                              @Override
                              public void onClick(View arg0) 
                              {
                                  if (arg0.getTag() != null &amp;&amp; arg0.getTag().getClass() == Integer.class)
                                      select((Integer)arg0.getTag());
                              }
                          });
                      }
                  });
              }
          }
  
      }).start();
  }
  </code></pre>
  
  <p>I was hoping that using a Handler would at least allow the new Activity to appear before the table was created. The application seems to freeze up for a few seconds when creating tables with a lot of rows. setTable() is being run in my Activity's onStart() method.</p>
  
  <p>Methods.createRow adds a row to the end of the TableView that is passed in.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>After deciding to try out a ListView, I got much better results with a lot less code.</p>
  
  <pre><code>private void setTable()
  {
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, roomNames);
      table.setAdapter(adapter);
      table.setOnItemClickListener(new OnItemClickListener()
      {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) 
          {
              select(arg2);
          }
      });
  }
  </code></pre>