Alvin Yates wrote:
> Quick question: Is there a way to start a new activity and close the
> current one?  Basically keep the Activity stack from growing, but my
> main concern is preventing multiple instances of the same Activity
> from spawning.

Call startActivity() to spawn the new one, then call finish() to close 
the old one. However, there may be better ways to skin this proverbial cat.

> I'm trying to create an app that will allow for changing views from a
> standard Activity layout to a Map Layout, but since forcing the layout
> back and forth crashes the app, it seems to require multiple
> Activities.  However, by doing so, hitting back repeatedly would cycle
> between views, not send the user out of the app.

Have you considered a ViewFlipper? Basically, have both layouts in one 
Activity, and toggle between them. While this means your one Activity is 
more pudgy than with just the single layout, this is probably less 
resource-intensive than killing and starting activities a lot.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to