Hi Mukesh,

I looked at your async-task-in-android blog post... 
But registering an Activity instance as a listener (WebServiceListener), 
you set yourself up for trouble.

E.g. if you click the 'Login' button (in your example) and your rotate the 
device and the login returns after that, the onPostExecute will call the 
'onLoginActionComplete' on the old and destroyed Activity (a configuration 
change destroys the original Activity). This will cause unexpected behavior 
and possible memory leaks.

Instead, use a Fragment (with setRetainInstance(true)) as your 
WebServiceListener or use an Object handled by 
onRetainNonConfigurationInstance/getLastNonConfigurationInstance as your 
WebServiceListener.


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

Reply via email to