title: How to add data from an SQLite Database into an ArrayList (Android)
body: <p>I'm relatively new to Android and I was making a To-Do List application. I have a database containing a column of tasks. How can I put these tasks into an ArrayList and display it ?</p>
  
  <pre><code>helper = new TaskDBHelper(MainActivity.this);
          SQLiteDatabase db = helper.getReadableDatabase();
          Cursor cursor = db.query(TaskContract.TABLE, new String[]{TaskContract.Columns._ID,TaskContract.Columns.TASK}, null, null, null, null, null);
  
          arrayListToDo = new ArrayList&lt;String&gt;();
  
  arrayAdapterToDo = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, arrayListToDo);
  
          ListView listViewToDo = (ListView) findViewById(R.id.listViewToDo);
          listViewToDo.setAdapter(arrayAdapterToDo);
  </code></pre>