title: Android SQL only returns one column
body: <p>I got a SQL database containing the following layout:</p>
  
  <p><a href="https://i.stack.imgur.com/mQh2t.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mQh2t.png" alt="SQL Table"></a></p>
  
  <p>The table is called <code>messages</code> with around 5 columns.</p>
  
  <p>I created an Cursor which should get all values from both columns using this:</p>
  
  <pre><code>public List&lt;String&gt; getContacts(SQLiteDatabase db) {
      List&lt;String&gt; List = new ArrayList&lt;String&gt;();
      // Select All Query
      String selectQuery = "SELECT `from`,`to` FROM messages";
      Cursor cursor = db.rawQuery(selectQuery, null);
  
      // looping through all rows and adding to list
      if (cursor.moveToFirst()) {
          do {
              List.add(cursor.getString(1));
          } while (cursor.moveToNext());
      }
      return List;
  }
  </code></pre>
  
  <p>And here I add the values to a ListView:</p>
  
  <pre><code>DatabaseHelper dbHelper = new DatabaseHelper(
              this.getApplicationContext());
  
      newDB = dbHelper.getWritableDatabase();
  
      List&lt;String&gt; all = dbHelper.getContacts(newDB);
      if (all.size() &gt; 0) // check if list contains items.
      {
  
          setListAdapter(new ArrayAdapter&lt;String&gt;(this,
                  android.R.layout.simple_list_item_1, all));
  
      } else {
          Toast.makeText(ConversationsList.this, "No items to display", 1000)
                  .show();
      }
  </code></pre>
  
  <p>And yes values gets added, but only the <code>me</code> which is very weird. What am I doing wrong?</p>
  
  <p>EDIT: Solved it by changing this:</p>
  
  <pre><code>if (cursor.moveToFirst()) {
              do {
                  List.add(cursor.getString(0));
                  List.add(cursor.getString(1));
              } while (cursor.moveToNext());
          }
  </code></pre>
  
  <p>To:</p>
  
  <pre><code>if (cursor.moveToFirst()) {
              do {
                  List.add(cursor.getString(0));
                  List.add(cursor.getString(1));
              } while (cursor.moveToNext());
          }
  </code></pre>