ObjectAnimator not serializable!!

  • Replies:2
Stephen Kong
  • Forum posts: 17

Apr 8, 2012, 4:58:56 PM via Website

I have a collection of game objects that perform animations with ObjectAnimator. When my game went to background and got killed for freeing up resources by Android, I need to be able to save all current state of the game objects (including current states of ObjectAnimators). But unfortunately ObjectAnimator is not serializable and therefore I was unable to preverse the current states of all these ObjectAnimator objects. How could I restore the current state of ObjectAnimator objects after my game brought back to foreground? Do I have to do it the hard way where I would have to manually retrieve every possible values from each ObjectAnimator object and save them?

— modified on Apr 8, 2012, 5:00:34 PM

Reply
Eric McBride
  • Forum posts: 1,790

Apr 10, 2012, 5:59:04 PM via Website

Im guessing this is a developers question, but I have to ask...what exactly is an ObjectAnimator?

Reply
Jeremiah
  • Forum posts: 775

Apr 10, 2012, 6:22:54 PM via Website

Eric McBride
Im guessing this is a developers question, but I have to ask...what exactly is an ObjectAnimator?

It's part of the android api, http://developer.android.com/reference/android/animation/ObjectAnimator.html
Basically it's a coding tool that part of android that developers can use to develop their apps, without having to start from square one.


I have a collection of game objects that perform animations with ObjectAnimator. When my game went to background and got killed for freeing up resources by Android, I need to be able to save all current state of the game objects (including current states of ObjectAnimators). But unfortunately ObjectAnimator is not serializable and therefore I was unable to preverse the current states of all these ObjectAnimator objects. How could I restore the current state of ObjectAnimator objects after my game brought back to foreground? Do I have to do it the hard way where I would have to manually retrieve every possible values from each ObjectAnimator object and save them?

Since it's not serializable your probably are going to have recreate the object animators on resume yourself. You can save which object animators are active and what their properties are as your own custom strings, then recreate them manually.

Reply