The document discusses AsyncTask and threads in Android. AsyncTask allows performing background operations and publishing results on the main thread without threading handling. It defines tasks with parameters, progress, and result types that have steps for pre-execution, background execution, progress updates, and post-execution.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
49 views12 pages
JAVA AsynTask & Thread Day - 1
The document discusses AsyncTask and threads in Android. AsyncTask allows performing background operations and publishing results on the main thread without threading handling. It defines tasks with parameters, progress, and result types that have steps for pre-execution, background execution, progress updates, and post-execution.
This method is in#oked on the !" thread immediately after the
task is exected. This step is normally sed to setp the task( for instance by showing a progress bar in the ser interface Asynctask & Thread
do"n0ackgrond&)arams...'( in#oked on the backgrond thread
immediately after on)re+xecte&' %nishes execting.
This step is sed to perform backgrond comptation that can
take a long time. The parameters of the asynchronos task are passed to this step.
The reslt of the comptation mst be retrned by this step
and will be passed back to the last step. Asynctask & Thread
This step can also se pblish)rogress&)rogress...' to pblish
one or more nits of progress. These #ales are pblished on the !" thread( in the on)rogress!pdate&)rogress...' step.
on)rogress!pdate&)rogress...'( in#oked on the !" thread after
call to pblish)rogress&)rogress...'. The timing of the exection is nde%ned. This method is sed to display any form of progress in the ser interface while the backgrond comptation is still execting. Asynctask & Thread
,or instance( it can be sed to animate a progress bar or show
logs in a text %eld.
on)ost+xecte&.eslt'( in#oked on the !" thread after the
backgrond comptation %nishes. The reslt of the backgrond comptation is passed to this step as a parameter. Thank 8o Apex T9 "ndia )#t. :td. +-;< =ec->- Noida Apex TG India E-20 , Sector 63, Noida 0120 4029000/9024/9025/902 !91-99535"454" E#ai$ id% pratap&apext'i(co# =tay ?onnected with s for more ))T on Android