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. Custom BaseAdapter + dynamic updates = crash in ListView layout





I would step through the getView() function in your custom adapter and see
what indices it's trying to get at when it breaks and how many objects you
actually have stored. That might give you more of a clue as to where you're
going wrong.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
http://sites.google.com/site/rezmobileapps/treking

-- 

2. how to set Wifi settings in Android simulator??

Hello,

I am working on an Android application which does http request and download 
contents etc. I want to test such cases on Android Simulator. I am using 
Android SDK 1.6. 
As my computer has Internet connectivity via Wifi, i'm trying to activate Wifi 
connectivity in Android Simulator as well, so that my code can get data 
connection access to download the data from http server. But when i try to 
connect it, it says 'Unable to start Wi-Fi' in the simulator wireless settings. 
I don't know how to set Wifi settings in Android simulator. Could someone help 
me on this?

Thanks.

Martin /





      

--

3. How can I create TextAppearanceSpan which looks like an anchor

4. Solved WTA : ngapus account di hero

5. Deciding which method to call when intent is received

6. Move buttons within Layout

7. Deciding which method to call when intent is received