Activity.startSubActivity() was just renamed to
startActivityForResult(), to make it clear that calling that function
doesn't set up some special kind of parent/child relationship (except
for where the result will go).

It sounds like you are really working against the activity model.  Why
not just create a second window (with the Dialog class) inside of your
parent activity, instead of trying to express everything as
activities?  If the activity model doesn't work for you for a
particular UI flow, you don't need to use it.

At any rate, the app state transitions are all described in the
Activity doc, in fair detail.  I would strongly urge reading,
understanding, and working within that model if you are using
activities, rather than trying to play sneaky games.

http://code.google.com/android/reference/android/app/Activity.html

On Sep 28, 4:49 pm, Joa <[EMAIL PROTECTED]> wrote:
> Activity.startSubActivity() would have been the way to go, but has
> been removed with SDK 0.9.  Here is how I worked around this problem:
>
> Unfortunately, any start of an activity (i.e. using
> Activity.startActivity(), Activity.startActivityForResult()) from
> within a "parent" activity calls the "parent's" onStop() method. This
> means the end of the "parent" activity, unless Activity.onStop() is
> not overridden to catch that call.
> Sp every time before I call Activity.startActivity() in the "parent"
> activity, I set a flag menuItemSelected. which the overridden onStop()
> evaluates to circumvent the termination of the "parent" activity. I
> have no visibility how the app state transitions play together with
> the various state change functions, but the following resulted in the
> desired behavior (i.e. keeps the "parent" activity alive):
>
> --------------- snip ------------------
>     @Override
>     protected void onStop() {
>
>         super.onStop();
>
>         if (!menuItemSelected) {
>                 this.finish();
>         }
>                 menuItemSelected = false;
>      }
> --------------- snip ------------------
>
> I am not sure if this is the right way to do it, but could not
> identify another solution.
> Hope this helps, JP
>
> On Sep 22, 5:02 pm, chouman82 <[EMAIL PROTECTED]> wrote:
>
> > this should be something simple but yet i can't seem to find the
> > answer anywhere.
>
> > I have a parent activity that starts a sub activity.  From the sub
> > activity, i want to be able to go back to the parent activity without
> > terminating the child activity.  Both activities will have UI so i
> > don't think service will work here.
>
> > So basically, is there a way for me to put the child activity to the
> > background by calling the parent activity and then from the parent
> > activity to get the child activity back without creating a new
> > instance of the sub activity (do i just callstartSubActivity(new
> > instance())?
>
> > Thanks in advance for your help
--~--~---------~--~----~------------~-------~--~----~
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