I am writing an application that does the following:
Bitmap
ImageView
I do not want them to run in the user interface thread, and obviously the second point cannot be executed without completing the first.
Can I customize AsyncTasks to achieve this? I mean the beginning of the second of the first method onPostExecute().
onPostExecute()
Is this considered bad practice? If so, how do I do this?
(this is a theoretical question, I am not asking for code)
, AsyncTasks, . : , .
AsyncTasks
AsyncTasks . AsyncTasks, . . AsyncTasks.
: AsyncTask. : AsyncTasks? , , . AsyncTask, , .
AsyncTask
, AsyncTasks , . , AsyncTask, , . , , , - - AsyncTask , , , , , , , .
AsyncTasks ? onPostExecute()
, AsyncTask . , . , .
, ?
. , ExecutorService, /,
, . , , . , : onPreExecute onPostExecute , , doInBackground - - . , AsyncTask doInBackground 1-, onPreExecute onPostExecute . .
onPreExecute
onPostExecute
doInBackground
, , , .
AsyncTask:
AsyncTasks ( ). , API, java.util.concurrent , , ThreadPoolExecutor FutureTask.
( Promises) - . A - ; .., .
:
Future( calculate and return x).map( consume x and return y) .map ( consume y and so on)
, , . , , , , .