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