Ackman Ackman - 1 year ago 105
reST (reStructuredText) Question

Android ensure HTTP response arrives

I am making a synchronous HTTP request and before my response arrives my UI loads and there is nothing to show.

How can I handle this?

I am using an expandable list and it is being populated using an okHTTP request.

Answer Source

if you are using ListView,RecyclerView etc then you can refresh your ListView or RecyclerView by


adapter is an custom component to plot on ListView or RecyclerView ( ViewHolder)

if you have are not using this then you can't use synchronous call , you have to make an asynchronous call. after successful asynchronous call assign the values to UI components like textview,editext etc.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download