android - Update a layout after an orientation change in a Fragment -


good day,

i'm working on application serve monitor of sort drivers. client application work regardless of orientation of device.

i implemented solution provided in following article , , after fiddling bit debugger, can see asynctask still working. however, textviews , imageviews supposed work on not working anymore.

here code of taskfragment.

to clarify : asynctask still receive , handle elements correctly, elements of layout not updated anymore. know how can keep them working.

i suggest using asynctaskloader can re-attach whatever lifecycle element created in relatively easily. see here: https://developer.android.com/reference/android/content/asynctaskloader.html

it might seem pretty involved implement @ first, if read https://developer.android.com/guide/components/loaders.html, of weirdness should cleared up.

tldr: using asynctaskloader allows easy way asynctask reattached fragment after destroyed , recreated. need call getloadermanager().initloader(...) in oncreate of fragment.


Comments