How to store object return by a cursor into a arraylist?
<p>I am taking object from sqlite database with the help of cursor. And I would like to store them into an arraylist. THe problem is that I dont know the size of my returned data in advance. So How do I put them into an arraylist?</p>

<p>code:</p>

<pre><code>public Student findAll()
    {
        db = helper.getWritableDatabase();
        Cursor cursor = db.rawQuery("select sid, name, age from t_student", null 
                );

        if(cursor.moveToNext())
            return new Student(cursor.getInt(cursor.getColumnIndex("sid")), cursor.getString(cursor.getColumnIndex("name")), cursor.getInt(cursor.getColumnIndex("age")));
        return null;
    }

Main:

ArrayList&lt;Student&gt; studentArrayList = new ArrayList&lt;Student&gt;();

        studentArrayList.add(dao.findAll()); //doing this will only return the first object from the database
</code></pre>
