Monday, June 6, 2011

[android-developers] Configuration change problem

I have an Activity. I am running a new thread from onCreate which is
creating a socket.
When the device goes from portrait to landscape mode or vice-versa the
Activity is getting restarted.
I have different UI (xml) file for portrait and landscape mode.
Creating a new socket every time and connecting to to Network,
degrades the performance.
To solve this problem I set this flag in manifest file
[android:configChanges="keyboardHidden|orientation"]
and override "onConfigurationChanged" in my activity.
I have to do setContentView inside onConfigurationChanged for changing
the UI. and setting up my UI again.
I just wanted to know is it the right thing I am doing or there are
better alternatives for this type of problems.

~janoti

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate