Unfortunately has stopped

后端 未结 4 613
渐次进展
渐次进展 2021-01-27 08:20

I have an app where the user submits some data in a form which is then sent to a server. I am testing it on a tablet and an Android smartphone (Galaxy S2). On the tablet, as soo

4条回答
  •  故里飘歌
    2021-01-27 08:52

    You're trying to run a network request on the main UI thread. Android does not allow you to do that since 3.0 (I believe). Doing so causes your UI to lock up until the request is completed, rendering your app useless during the execution of the request.

    You'll either have to run your request in a new Thread or an ASyncTask, to take the load of the UI thread. You can find more info on how to use multiple threads here.

提交回复
热议问题