完成 AsyncTask 后未调用 onPostExecute [英] onPostExecute not called after completion AsyncTask

查看:37
本文介绍了完成 AsyncTask 后未调用 onPostExecute的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我的 AsyncTask 完成后没有调用我的 onPostExecute().

For some reason my onPostExecute() is not called after my AsyncTask finishes.

我的类声明:

public class setWallpaperForeground extends AsyncTask

我的 onPostExecute():

My onPostExecute():

protected void onPostExecute(Boolean result)

一切正常,我的 doInBackground() 成功完成并返回一个布尔值,但它刚刚完成.

Everything works fine, my doInBackground() completes successfully and returns a Boolean but then it just finishes.

谢谢

推荐答案

您是否在 UI 线程上创建了 AsyncTask?还要在 onPostExecute() 方法上添加 @Override annotaiton 以确保正确声明它.

Did you create your AsyncTask on the UI thread? Also add an @Override annotaiton on your onPostExecute() method to make sure you declared it correctly.

这篇关于完成 AsyncTask 后未调用 onPostExecute的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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