Wednesday 15 April 2015

android - Intent dependendent on 2 API calls? -



android - Intent dependendent on 2 API calls? -

suppose have situation api response fills instrumentalist model info specific musician. there api response that, given instrumentalist name, describes related artists.

i want launch detail activity showing musician's name, members, genre, albums(api response a) along related artists(api response b).

an asynchronous network phone call provide improve user experience, since launching detail activity dependent on 2 different api calls, there improve solution having api phone call asynch , api phone call b synch(blocking , ui)?

if create both asynchronous, api phone call b running while activity changes, stopping it(since asynctask destroyed when activity changes). result in missing info in detail activity.

in simple case:

start detail activity execute both requests asynchronously while presenting user loading ux once retrieved, update ui accordingly you can alter layout of activity @ time @ runtime without recreating it. you can either update ui "response a" , 1 time again "response b" or wait both responses homecoming , update ui; former preferable.

network operations should never block ui or user. displaying loading spinners , such acceptable , used time in google's own apps.

android android-async-http

No comments:

Post a Comment