开发者

App keeps dying after http request results are put into layout

I honestly could not think of a good title. Sorry. Anyway, so I have an app that I am making where I pull information from my custom web api. I pull data from the api and fill in the layout with this information. Problem is it takes a while so the app stalls for a few seconds before the information is pulled since it is in the onCreate method of the activity. To resolve this I implemented a loading dialog. This is where the problems began. I put the http requests into a seperate thread and it downloads fine. No problem. However it keeps force closing every 开发者_开发知识库time I try to modify the layout afterward. So basically my question is how do I modify the layout after the background thread is finished? Everything I try keeps force closing the app.


Use an asynctask. You're trying to update the UI from a different thread. You can't do that. There's about 11 billion other questions on this exact same subject

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜