Android code after httpclient.execute(httpget) doesn't get run in try (using AsyncTask)

后端 未结 2 1160
野趣味
野趣味 2021-01-21 03:16

I\'m trying to get data from a website and parse it into my android application. Unfortunately I don\'t even get to the part of parsing the data. The code doesn\'t run after the

2条回答
  •  旧巷少年郎
    2021-01-21 03:27

    One problem you have is you are attempting to update the screen (message) from a background thread. Use AsyncTask.publishProgress(...) to let the main thread update the GUI in its onProgressUpdate() method.

    Also rather than updating the screen, consider writing log messages Log.d(TAG, "You Are Here.); and watching them in logcat.

    This doesn't address the HTTP issue, but clear this up first to be sure you are not causing a hang by changing the screen in a background thread.

提交回复
热议问题