Ackman Ackman - 3 months ago 14
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

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

adapter.notifyDataSetChanged();

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.

Comments