有没有办法在onPostExecute
方法内部过滤 AsyncTask 的结果?我打算显示一个 MultipleChoice-property AlertDialog.Builder 来过滤掉结果而不结束或关闭 ProgressDialog。
这是我想做的过程。
AsyncTask.onPreExecute
- show ProgressDialog
AsyncTask.doInBackground
- scan all files on `Environment.getExternalStorageDirectory().listFiles()`
AsyncTask.onPostExecute
- filter the result parameter (this can be passed to another method of the Activity class or the AsyncTask class)
- display AlertDialog.Builder with multiple selection property (for example, file extension names)
- wait to finish selection on the shown AlertDialog.Builder
- display AlertDialog.Builder with multiple selection property (for example, file directories)
- wait to finish selection on the shown AlertDialog.Builder
] // do something with the filtered result
] dismiss ProgressDialog
2013 年 2 月 6 日更新:
- 更新过程由上述完成
AsyncTask
。 - 过滤过程可以作为另一种方法放置在 Activity 类文件中。