On Mon, Jul 27, 2009 at 8:35 PM, rukiman <[email protected]> wrote:
> Yes I did mean Java serialization. Any reason why I can't use it > (apart from it being slow) ? Um... it being super-crazy slow? :) The game has lots of objects in memory and references to objects, it > will be a bit tricky to write my own custom code to serialize hence > why I went with the Java serialization as it > automatically handles serializing only one copy of the object and > marking others as references etc. There might be a better way to do > it, but relatively new at it and couldn't think of an easier way at > the time. To complicate matters most of the game code I am serializing > wasn't written by me. Well you can try running the profiler on your code and seeing if something besides the serialization code itself (that is something in your own code that you can rework) is slow. You may just need to dump the serialization to have decent performance, though. > So if I was to start a service, can I do that in the onPause? What if > my activity received an onPause and was destroy straight away because > the new activity chews too much memory, won't my game data in memory > be lost at the same time? Or will it still remain in memory as the > service has a reference to it? The point of starting a service is that your process is more likely to stay around. Not guaranteed if the system is under extreme memory pressure, but much less likely. (The Service runs in the same process as the activity, so can share all of the same state.) -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

