android - Can Honeycomb Loaders solve problems with AsyncTask + UI update? -


doing in background , updating ui hard implement correctly in android. it's badly designed. typical example asynctask fetches web , displays result. there 2 problems this:

  1. the asynctask has reference activity (because needs update ui). after screen orientation change, activity restarted. asynctask still references old destroyed activity therefore can't update ui of new activity.

  2. this can lead outofmemoryexception. imagine have activity lots of bitmaps , start asynctask. press (activity finished) asynctask still running , because references activity, activity bitmaps still in memory. repeat (start activity , back) , have force close sooner or later.

this can solved, way complicated. in 1 activity have 3 different asynctasks, each of them can running in several instances simultaneously. implementing correctly frustrating. code becomes hard understand , debug.

can honeycomb loaders somehow solve this? , there way use them in pre-honeycomb android versions?

yes, experience loader seem solve common problems people have asynctasks , configuration changes.

i think google said fragments static library include loaders yes, should work backwards when library released.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -