android - Don't reload Activity orientation change but still reload Fragments -


im using mainactivity few fragments.

in activity connect server.

i used: android:configchanges="orientation|screensize" in manifest.

so activity keeps connection on orientation change.

but cant use different layout port/land (fragments).

is there way force fragments reload on change without activity reloading?

you need move network operations outside of activity/fragment lifecycle activity , fragments can work intended , can have long running network operations aren't interrupted activity , fragment lifecycles. remember activities , fragments meant dynamic, have narrow concerns, etc. they're not designed network operations. that's why there's emphasis on using background threads various things , why there services. example, use intentservice handle network operations. here's example of how activity deal resuming/updating information when configuration changes happen: https://stackoverflow.com/a/4481297/2306657


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -