同时显示进度条的AsyncTask的方向改变应用程序崩溃 [英] Application Crashes on orientation change while showing Progress Bar in AsyncTask

查看:116
本文介绍了同时显示进度条的AsyncTask的方向改变应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用的AsyncTask从服务器获取JSON文件等显示进度条的应用程序。不过,虽然显示进度条和方向改变时,应用程序的显示崩溃VIEW未连接错误或已泄漏WINDOW错误

I have an application which uses AsyncTask to get the json file from server and so shows the Progress Bar. But while showing the progress bar and the orientation is changed, the application crashes showing VIEW NOT ATTACHED error or HAS LEAKED WINDOW error.

如何摆脱这些错误的?否则,应用程序工作正常上AsyncTask的。

How to get rid of these errors? Otherwise the application works fine on AsyncTask.

推荐答案

试试这个为您的活动。虽然这不是很干净。它可以帮助

Try this for your activity. Although it is not very clean. It can help

<activity android:configChanges="orientation|screenSize" android:name=".activity.MyActivity" ></activity>

这篇关于同时显示进度条的AsyncTask的方向改变应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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