异步任务的Andr​​oid onPostExecute [英] Async task android onPostExecute

查看:115
本文介绍了异步任务的Andr​​oid onPostExecute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Andr​​oid应用程序,我使用的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 这么简单的回报从 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.

这篇关于异步任务的Andr​​oid onPostExecute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆