Friday, May 7, 2010

[android-developers] Re: Struggling with Activity/View framework

The Activity may be killed, but the Application will not be. You can
hold onto state there.

However, it would be best to carefully study the lifecycle and look to
minimize how much information you keep there, and ALLOW information to
be discarded (or selected information to be kept) when the activity
that needs it is killed.

Note that simply starting a new activity does NOT guarantee the
previous activity is killed, it only allows for it

All the tools you need are there for information to persist with the
appropriate lifetime.

You should also consider persisting state in a database, preferences
object, or file, rather than retaining it in memory. There's tradeoffs
between memory usage and the cost of reloading data, but reducing
memory usage is important in this environment.

On May 4, 1:06 pm, Leigh McRae <leigh.mc...@lonedwarfgames.com> wrote:
> I am hoping that someone can help me out with my port to Android.  My
> game has abstracted out a few services and a couple of screens.  There
> services are fine but I have an options screen that needs to be
> implemented using native UI.
>
>  From reading the docs, I gather that I should be using an Activity
> paired with a View for the screen.  The problem is that showing a screen
> forces my Activity to be killed.  I tried to implement the options
> screen using a dialog but then I am restricted from using another
> dialog, for feedback, in the screen.
>
> The whole life cycle of an Activity is really a ball breaker.  Most
> games load everything they need at startup and never allocate again.  So
> having a game save it's full state, not just save game, is a real
> challenge.  When you add in OpenGL, you pretty much have to keep a
> backing store of all the textures.
>
> What is one to do?
>
> --
> Leigh McRaewww.lonedwarfgames.com
>
> --
> 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 athttp://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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment