Pages

AsyncTask

This is what I ended up with. I've stripped the uninteresting code in the interests of clarity.
 
public void fillData() {
   new LoadDataTask().execute(this, transactionSortOrder, dateFilter);
}

private class LoadDataTask extends AsyncTask<Object, Integer, ArrayList<SeauTransaction>> {

   @Override
   protected ArrayList<SeauTransaction> doInBackground(Object... params) {
      this.activity = (Activity) params[0];
      return getData(activity, transactionSortOrder, dateFilter);
   }

   protected void onPostExecute(ArrayList<SeauTransaction> result) {
      fillAdapter(activity, result);
   }

}

private ArrayList<SeauTransaction> getData(Context activity, TransactionSortOrder transactionSortOrder,
   AbstractDateFilter dateFilter) {

   return dbAdapter.getSeauTransactionList(transactionSortOrder, dateFilter);
}

private void fillAdapter(Activity activity, ArrayList<SeauTransaction> seauTransactionList) {

   transactionAdapter = new SeauTransactionAdapter(activity, seauTransactionList);
   setListAdapter(transactionAdapter);
}