title: How to build Arrays, push to them, and loop through them in Java/ Android
body: <p>I come from an action script back ground and i am baffled by how to use arrays in java.  </p>
  
  <p>In my main activity i created an empty array called mIcons like so</p>
  
  <pre><code>private Array mIcons;
  </code></pre>
  
  <p>Now i want to set the value of that array by using a method from my DataBaseHelper class which looks like this:</p>
  
  <pre><code>public Array getHomeScreenIcons() {
  
          Array iconList;
  
          // Select All Query
          String selectQuery = "SELECT  * FROM " + homeIcons;
  
          SQLiteDatabase db = this.getWritableDatabase();
          Cursor cursor = db.rawQuery(selectQuery, null);
  
          // looping through all rows and adding to list
          if (cursor.moveToFirst()) {
              do {
  </code></pre>
  
  <p><em><strong>iconList.push(Integer.parseInt(cursor.getString(0)));</em></strong></p>
  
  <pre><code>            } while (cursor.moveToNext());
          }
          Log.v(TAG, "List Created"); 
          // return contact list
  
  }
  </code></pre>
  
  <p>that bold line jumping out of the code is the problem so far.. how do i PUSH to my array</p>
  
  <p>Then later i will want to run a for loop for the array from my main activity using.length</p>