Android: Activity taking too long to display because of web service Http Request

前端 未结 6 554
野性不改
野性不改 2021-01-28 03:17

One of my activities make a http request to a webservice to get some weather data when I start the application.

The issue that the activity will take 3-4 seconds to disp

6条回答
  •  后悔当初
    2021-01-28 04:16

    You can use AsynchTask class for your web service.You can write your time consuming task in on doInBackground.Also you can use a progress Dialog. Here You can see how to work with AsynchTask.You can also update your UI while web service is parsing without waiting for the complete parsing using onPostUpdate method.

提交回复
热议问题