Consider the scenario where I have get data from server and post it to UI in say list view , but this is an going activity ,it never stops.
taskA{ //fetches data over network
if(!update)
fetch();//network operation
}
taskB{//using this data UI is updated at runtime just like feed.
if(update)
show();//UI operation
}
taskA starts first after it completes taskB starts by that time A is sleeping and vice versa , goes , now the problems i am facing are:
- both operations have to be in worker thread
- both operations are going in cycle till activity is alive.
- if handler is used to post UI operation to the main thread , taskB seems to stop.
Can anybody please suggest me a design to get this working?