Thanks for the reply Ralf.

It is just for the sake of convenience that I took only three activities.
Ideally I want to be able to jump back from nth activity to (n-m)th activity
(m>0, n>m)  but atleast if it is possible to jump back to starting activity
from nth activity with starting activity's state undisturbed that would do.

"A2 can start A3 and then A2 can call finish on
itself. This way the stack is A1 A3."  -  When we press back button from A3
i want A2 to be displayed cannot remove A2 from the stack.

-Aditya

On Sun, Dec 14, 2008 at 11:57 PM, Ralf <ralfo...@gmail.com> wrote:

>
> On Fri, Dec 12, 2008 at 5:55 AM, mady369 <aditya.mare...@gmail.com> wrote:
> >
> >
> > That was informative but unfortunately didn't solve my problem :(
> >
> > I have written an app.  with three Activities A1, A2, A3.   A2 can be
> > launched from A1 and A3 can be launched from A2.
> >
> > Suppose if we are in A3 (the activity stack has A1, A2, A3
> > activities),  now is it possible to jump from A3 to A1? If so how do
> > we do it? Also when I jump back the stack should be cleared to that
> > point.
>
> If you want to have A1 A2 A3 and always go back to A1 from A3, what
> you can do is that A2 can start A3 and then A2 can call finish on
> itself. This way the stack is A1 A3.
>
> R/
>
> >
> >  I tried launching A1 from A3 with intent flag
> > Intent.FLAG_ACTIVITY_CLEAR_TOP  - the stack is cleared but this
> > recreates A1(the old state of A1 is lost), if we set the launchMode of
> > A1 to singleTask in the Manifest file then this works fine.
> >
> > But setting the launchMode of A1 to singleTask is causing some other
> > weird problem - if we press home button from A2 or A3 and then come
> > back to the application A1 is shown instead of A2.
> >
> > Can you please explain what is happening here? What am i doing wrong?
> >
> > P.S - I used the following code to launch activities
> >
> > Intent i = new Intent(this, A3.class);
> > startActivity(i);
> >
> > and my AndroidManifest.xml file looks like this-
> >
> > <?xml version="1.0" encoding="utf-8"?>
> > <manifest xmlns:android="http://schemas.android.com/apk/res/android";
> >      package="com.aditya.jumpactivitystack"
> >      android:versionCode="1"
> >      android:versionName="1.0.0">
> >    <application android:icon="@drawable/icon" android:label="@string/
> > app_name">
> >        <activity android:name=".A1"
> >                  android:label="@string/app_name"
> >                  android:launchMode="singleTask">
> >            <intent-filter>
> >                <action android:name="android.intent.action.MAIN" />
> >                <category
> > android:name="android.intent.category.LAUNCHER" />
> >            </intent-filter>
> >        </activity>
> >        <activity android:name=".A2">
> >            <intent-filter>
> >                <action android:name="android.intent.action.VIEW" />
> >                <category
> > android:name="android.intent.category.LAUNCHER" />
> >            </intent-filter>
> >        </activity>
> >        <activity android:name=".A3">
> >            <intent-filter>
> >                <action android:name="android.intent.action.VIEW" />
> >                <category
> > android:name="android.intent.category.LAUNCHER" />
> >            </intent-filter>
> >        </activity>
> >    </application>
> > </manifest>
> >
> > -Aditya
> >
> > Megha Joshi wrote:
> >> Thanks Renato.  I also wanted to point out Dianne Hackborn's response to
> a
> >> similar issue in the following thread:
> >> http://groups.google.com/group/android-developers/msg/1abf3707770a4aa6
> >>
> >> Hope this helps!
> >>
> >> Megha
> >>
> >> On Jan 30, 2008 6:30 AM, Renato Mangini <mang...@gmail.com> wrote:
> >>
> >> >
> >> >                 IBinder ib= ((IBinder) ServiceManagerNative.getDefault
> >> > ().getService("activity"));
> >> >                 IActivityManager am =
> ActivityManagerService.asInterface
> >> > (ib);
> >> >                 am.moveTaskToFront(taskID);
> >> >
> >> > Disclaimer: this is undocumented and probably won't work on new SDK.
> Also,
> >> > you are required to know in advance the taskID of your activity (
> >> > activity.getTask()).
> >> >
> >> > Renato Mangini.
> >> >
> >> >
> >> >
> >> > On 1/30/08, Joe <pencil...@hotmail.com> wrote:
> >> > >
> >> > >
> >> > > StartActivity always create a new activity, How I bring the
> background
> >> > > activity to the foreground
> >> > >
> >> > >
> >> >
> >> > >
> >> >
> >
> > >
> >
>
> >
>

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