using AsyncTask to display data in ListView

前端 未结 2 1299
猫巷女王i
猫巷女王i 2020-12-11 09:30

I need me a little help. I need to use asynctask to display data in ListView. But I don\'t know how becouse I\'m new in Android programming ... thank you ve

2条回答
  •  清歌不尽
    2020-12-11 10:09

    Do not download any data in your onCreate() - if it takes too long then you will get ANR exception (Activity Not Responding). You should use AsyncTask as in your question. For AsyncTask you have very good example on android site:

    http://developer.android.com/reference/android/os/AsyncTask.html

    you should put JSONfunctions.getJSONfromURL() inside doInBackground()

    and all whats below in onPostExecute()

提交回复
热议问题