title: How to get all single column values then pass it to String[]?
body: <p>I got a big problem here. I create databasehelper class to handle all of my query function.
  Now I try to make a function that will load all values of a column from my database but I dont know how to do it. FYI I got 3 columns inside my database table. Here is my code so far:</p>
  
  <p>(UPDATED, it works and gives me values now)</p>
  
  <pre><code>public List&lt;Content&gt; getSearchKeys() {
      List&lt;Content&gt; contentList = new ArrayList&lt;Content&gt;();
      // The query
      String selectQuery = "SELECT  * FROM " + TABLE_SEARCH;
  
      SQLiteDatabase db = this.getWritableDatabase();
      Cursor cursor = db.rawQuery(selectQuery, null);
  
      // I use do.. while here and it works now, should I better use for loop?
      if (cursor.moveToFirst()) {
          do {
              Content content = new Content();
              content.setID(Integer.parseInt(cursor.getString(0)));
              content.setsKeys(cursor.getString(1));
              content.setAct(cursor.getString(2));
              // Adding content to list
              contentList.add(content);
          } while (cursor.moveToNext());
      }
      // return content list
      return contentList;
  }
  </code></pre>
  
  <p>The problem now is how to pass the result of above function into String[] ? In my Activity I try to use it like this and it's not working:</p>
  
  <p>(Updated)</p>
  
  <pre><code>...
  setContentView(R.layout.page_search);
  
      DatabaseHandler db = new DatabaseHandler(this);
      List&lt;Content&gt; contents = db.getAllContacts(); 
      final String[] searchQ = new String[contents.size()];
      int i =0;
  
        for (Content cn : contents) {
              searchQ[i] = cn.getsKeys().toString(); 
        }
  
        final String[] SearchQueries = searchQ;
  </code></pre>
  
  <p>If I comment the code above and change it to string array like this, then it works:</p>
  
  <pre><code>static final String[] SearchQueries = new String[] { "iPhone", "Mac", "Apple",};
  </code></pre>
  
  <p>My aim is to replace array above into Array I retrieve from my database. So what's wrong and what's the correct method to handle this? Many thanks for your help.</p>