Thursday, August 25, 2016

Fluid UIs-The Correct Asynch Construct

I have to change my framework code as obviously AsynchTask is not the correct Asynch construct to use. It's not correct as the AsynchTask is not android lifecycle aware.

We want to use AsynchTaskLoader as its android lifecycle aware and does not hold a reference to any UI part. It helps prevent the Task from trying to communicate with a destroyed UI view such as in the case of the device orientation changing.

If it was known to be longer background task, its just formatting display data and populating the ViewModel or Presentation Model, than I would be using the FutureTask which provides an added feature of being cancel-able.

True I could break down and use RxJava's Observable, but my point is its not necessary to bring in Rxjava if you know the correct choices in your implementation of a fluid UI.