saving to the database in an Asynchronous task. Android

view story

http://stackoverflow.com – So what I am trying to do is to insert into the database. I found the following code online at http://www.vogella.com/articles/AndroidSQLite/article.html What is important for me is shown in the following block ArrayAdapter<Comment> adapter = (ArrayAdapter<Comment>) getListAdapter(); Comment comment = null; switch (view.getId()) { case R.id.add: String[] comments = new String[] { "Cool", "Very nice", "Hate it" }; int nextInt = new Random().nextInt(3); // Save the new comment to the database comment = datasource.createComment(comments[nextInt]); adapter.add(comment); (HowTos)