Orientation changes:

http://developer.android.com/resources/articles/faster-screen-orientation-change.html

Also consider using onPause / onStop to handle the user leaving the
activity, and consider using a service so it can run independently of the
activity.

-- Kostya
2011/6/29 Gustavo Vargas <xgvar...@gmail.com>

> Ok, I know pointers don't exist in Java, but I was wondering if there
> is a way to mimic its behavior or any other mechanism that let me keep
> the reference to an object when my activity restart from a softkill.
>
> inside the onCreate of my activity I have something like that:
>
> work= new workThread(....);
>
> this class workThread is not really a thread but its contructor
> instanciate a real thread, and everything works fine, till I change
> the orientation or leave my app.
>
> the original workThread is still running in background all the time to
> keep a socket opened.
>
> when I go back to the app the onCreate instanciate a whole new
> workThread object and when it runs it throws an exception becouse the
> socket is already opened.
>
> I know how to use the onSaveInstanceStatus and the Bundle at onCreate
> to restore non View variables. But, as far I know, I only can do this
> for basic types like int, String, etc.
>
> What I need to keep is the reference to the original "work" object
> created on the very first onCreate.
>
> There is a way to do that?
>
> Thanks a lot for any help
>
> --
> 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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to