I have gone through different posts and questions for handling rotation and AsyncTask
. In each post it is mentioned that using android:configChanges
is
To sum up all what i got form @user13 answer and other stackoverflow questions and blog posts i would like to share my finding to clear some very important aspects.
(user13) It's not bad practice to use android:configChanges, but it pretty easily can be, if you don't understand exactly what you're doing
Using this technique prevents you from easily using configuration specific resources. For instance, if you want your layout or drawables or strings or whatever to be different in portrait and landscapes, you have to manage it yourself if you use android:configChanges
.
onConfigurationChanged()
method to perform specific action if you decide to use android:configChanges
android:configChanges
only handles one case and there will be unhandled cases of activity restart which will cause a potential bug.android:configChanges
should be used as a last resort according to documentation.