title: fetching multiple values from the table
body: <pre><code>public List&lt;String&gt; getDays(long iid)
  {
    List&lt;String&gt; days= new ArrayList&lt;String&gt;();
    cursor = database.query(MySqliteHelper.TABLE_REPEAT, daysColumn, MySqliteHelper.COLUMN_TID + "=" + iid, null, null, null, null);
    while(fg&gt;=1)
    {
        cursor = database.query(MySqliteHelper.TABLE_REPEAT, daysColumn, MySqliteHelper.COLUMN_TID + "=" + iid, null, null, null, null);
            String day = cursor.getString(cursor.getColumnIndex(MySqliteHelper.COLUMN_DAYS));
          days.add(day);
        cursor.moveToNext();
            if(cursor.isAfterLast())
            {
         fg=0;
            }
    }
    cursor.close();
    fg=1;
    return days;
    }
  </code></pre>
  
  <p>now I get the <code>arrayindexoutofbound</code> exception!! I'm new to android and programming.. 
  suggest me what techniques I should use.</p>
  
  <p>and my log cat shows:
  03-06 11:20:12.941: E/AndroidRuntime(2025): FATAL EXCEPTION: main
  03-06 11:20:12.941: E/AndroidRuntime(2025): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.habitator/com.example.habitator.AlarmDays}: android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1</p>