异步任务的Android onPostExecute [英] Async task android onPostExecute
问题描述
在我的Android应用程序,我使用的AsyncTask从互联网上下载的图片。
In my android application i use AsyncTask to download the image from internet.
我通过了网址和我的AsyncTask做下载。但我怎么回位图回到我的活动。目前,我通过回调函数,以我的AsyncTask的构造函数和OnPostExecute我调用回调函数。这是做了正确的道路。
I pass the url and my AsyncTask does the download. But how do i return the bitmap back to my activity. Currently i pass the callback function to my asynctask constructor and in the OnPostExecute i invoke the callback function. Is this the correct way to do it.
推荐答案
您从 doInBackground
传递给 onPostExecute $ C返回结果$ C>这么简单的回报从
doInBackground
方法的位图,并在 onPostExecute
。
The result you return from doInBackground
is passed to onPostExecute
so simple return the bitmap from doInBackground
method and handle it in onPostExecute
.
这篇关于异步任务的Android onPostExecute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!