扫码关注官方订阅号
然而将解析操作写在doInBackground方法中不会报错。
走同样的路,发现不同的人生
解析是个耗时操作,应该放在子线程,onPostExecute是主线程,doInBackground是子线程.
onPostExecute
doInBackground
你在主线程做了耗时操作,报错了很正常.
你应该把InputStream 换成获取到的数据 String
然后在onPostExecute()中解析
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
解析是个耗时操作,应该放在子线程,
onPostExecute是主线程,doInBackground是子线程.你在主线程做了耗时操作,报错了很正常.
你应该把InputStream 换成获取到的数据 String
然后在onPostExecute()中解析