Thanks -- but I'm not sure what you're suggesting.  I don't see a
startActivity(Activity,Class) in the docs.  If I'm missing it or the
signature's different, when are you suggesting I call it?  After the
OS launches a second instance of my root Activity on top of the
browser?  I could see this working if I could transmit the Intent that
second instance is passed back to the first instance *and* if I could
then force that instance to come to the front (on top of the task the
browser's in that the user's interacting with).  But I've tried that
already -- calling into the first instance via private methods -- but
am stuck on how to bring it to the front.  Android doesn't want me to
do that, so I keep thinking there has to be an easier way to do this,
one that the APIs anticipate.

Thanks,

--Eric

On Dec 14, 9:17 pm, damodhar meshram <damodhar.meshram...@gmail.com>
wrote:
> when u call second activity from first one please finish first then call
> second one
>
> used following code :
>
> startactivity(this,yourclassname.class);
> finish();
>
>
>
> On Thu, Dec 15, 2011 at 10:42 AM, eehouse <eeeeho...@gmail.com> wrote:
> > I'm writing a board game that follows a common pattern: main Activity
> > is a list of games, and if you tap on one it opens into a second
> > Activity in which the game is played.  You close one game to play
> > another.  Games can also be launched over the network, which happens
> > when the user goes to a .php page in the browser that redirects to a
> > custom URL scheme for which one of my Activities has an intent-filter.
>
> > I want to ensure three things
>
> > * If user opens the app, then launches a game into an Activity on top
> >  of the list Activity, then taps the home button and launches the app
> >  again, he'll be taken back to the second Activity with the game in
> >  progress, just as it was.  (This is standard behavior on Android.)
>
> > * If he browses to the .php page and triggers a new game, the app will
> >  display the new game in its own Activity on top of the list
> >  Activity, first closing any other game Activity that might be open.
>
> > * If this happens while the app is already running, whether in the
> >  same task as the browser or not, the new game will be launched on
> >  top of the existing game list Activity -- no new game list Activity
> >  will be created.
>
> > This last one's the problem.  The way things are working now, with the
> > game list Activity's launchMode set to singleTop, if the game's
> > already running in a different task and the user browses to the .php
> > page that triggers new game creation, a second instance of the game
> > list Activity is created with the new game Activity on top of it.
> > This is fixed if I make launchMode be singleTask, but then my first
> > goal fails: If the user hits the home button while a game is open then
> > relaunches the app it comes back not to the existing game Activity but
> > to a new root game list Activity.
>
> > I'm beginning to work toward a solution that has the root Activity
> > registering with a static class so that I can tell it's running (and
> > can have it finish() if the OS insists on launching a duplicate), and
> > the
> > child game Activities registering with their parent so the parent can
> > kill them if it needs to.  But it's going to be pretty complex, and
> > probably racy.  It seems this scenario should have been anticipated,
> > that there's probably a simple way to do it using launch modes and
> > Intent flags I'm not finding.  Suggestions?
>
> > Thanks,
>
> > --Eric
>
> > --
> > 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+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Thanks and Regards,
> Damodhar Meshram
> Sr Android Developer

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to