Struggling with Activity/View framework

by Leigh McRae » Wed, 05 May 2010 04:07:34 GMT


Sponsored Links
 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 McRae
www.lonedwarfgames.com

--



Struggling with Activity/View framework

by Bob Kerns » Fri, 07 May 2010 23:34:14 GMT


 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.



>


Sponsored Links


Other Threads

1. Spinner Style

Hi friends,

           As part of my project I need a spinner that should display
items like HTML select tag rather opening a new window.
           Is it possible...?

-- 

2. Keeping a service alive till the phone is switched off

Hi, once we call the startService() method, can we keep the service
alive until its explicitly stopped by the user? I want my service to
stay alive until the phone is switched off. How can i do this? The
idea is that when I receive an incoming call, I want to start
recording and once the status changes to idle, I want to stop the
recording. I am doing this inside my service. It does work sometimes
and sometimes it doesn't. How can I implement such a thing in a
service? Can someone help me with this? Thanks

David

-- 

3. Intent and extras

4. ADB device name show invalid characters

5. Add view to an layout by Z index?

6. Reg: Accessing a service in other package.

7. Is that possible to print backtrace when debug native code