Android :: How To Manipulate Activity Back Stack?

Nov 22, 2010

I want to implement the following logic. I have 4 activites A, B, C and D. The flow is A -> B -> C -> D When the user navigates from A -> C he should be able to get back to the previous activities by pressing the back button. But after reaching D pressing the back button should take him to activity A. And pressing the back button againg should exit the application instead of taking him back to B / C / D. How do I do it.

Android :: How to manipulate Activity back stack?


Android :: Way To Manipulate The Droid Activity Stack?

Jun 23, 2010

1 - User opens app for the first time ever from android home screen User is presented with "first time" screen (backed by first time activity, lets call it A) User hits back button user is returned to android home screen 2 - User opens app for second time User is presented with the main list screen of the application (backed by a list activity, let's call it B) User hits back button User is returned to android home screen I'm already aware of numerous ways to detect whether it's the first time opening the app or not. The problem is in having the back button return to the home screen rather than a routing activity that decides which screen to forward to.

View 1 Replies View Related

Android :: Any Way To Go 2 Steps Back In Activity Stack?

Apr 7, 2010

Android - Can I force BACK button to go 2 steps back in the Activity stack with some kind of code? I know I can override the onKeyDown method but I want BACK to do it's thing, just twice!

View 3 Replies View Related

Android :: How To Clear Stack Back To Root Activity When User Leaves Application?

Jan 25, 2010

I have an application with 2 activities, LogonAct and MainAct. LogonAct is a logon activity which I want to force the user to go through each time they return to the application. I've set android:clearTaskOnLaunch="true" on LogonAct.

View 1 Replies View Related

Android :: On Logout Clear Activity History Stack Preventing Back Button

Jun 9, 2010

All activities in my application require a user to be logged-in to view. Users can log out from almost any activity. This is a requirement of the application. At any point if the user logs-out, I want to send the user to the Login Activity. At this point I want this activity to be at the bottom of the history stack so that pressing the "back" button returns the user to Android's home screen.

I've seen this question asked a few different places, all answered with similar answers (that I outline here), but I want to pose it here to collect feedback. I've tried opening the Login activity by setting its Intent flags to FLAG_ACTIVITY_CLEAR_TOP which seems to do as is outlined in the documentation, but does not achieve my goal of placing the Login activity at the bottom of the history stack, and preventing the user from navigating back to previously-seen logged-in activities. I also tried using android: launchMode ="singleTop" for the Login activity in the manifest, but this does not accomplish my goal either (and seems to have no effect anyway). I believe I need to either clear the history stack, or finish all previously- opened activities. One option is to have each activity's onCreate check logged-in status, and finish() if not logged-in. I do not like this option, as the back button will still be available for use, navigating back as activities close themselves. The next option is to maintain a LinkedList of references to all open activities that is statically accessible from everywhere (perhaps using weak references). On logout I will access this list and iterate over all previously-opened activities, invoking finish() on each one. I'll probably begin implementing this method soon.

I'd rather use some Intent flag trickery to accomplish this, however. I'd be beyond happy to find that I can fulfill my application's requirements without having to use either of the two methods that I've outlined above. Is there a way to accomplish this by using Intent or manifest settings, or is my second option, maintaining a LinkedList of opened activities the best option? Or is there another option that I'm completely overlooking?

View 2 Replies View Related

Android :: Stack Of Activity From Activity Stack

Nov 2, 2009

There is a stack of activity i want to call the activity from that stack , My question is that is it possible to check from that stack and call that intent.When i press home button and again when i press the executable it should start the activity where i have left .Is it possible?Any example related to the same would be great help

View 3 Replies View Related

Android :: How To Clear Activity Stack If Using Same Activity Multiple Times?

Mar 3, 2010

So I have an app with Activity A. The layout on the activity is dynamic genearted. So it's possible that on Activity A a user hits a button that goes to "A" and the new page looks different, then a user clicks another button to go to "A" again. Now I have 2 Activities in the history stack. A, A, and currently on A. Is it possible that if a user clicks a button that the whole Activity stack is cleared in a scenario such as this?

View 5 Replies View Related

Android :: Finish Any Previous Activity In Stack From Current Activity?

Apr 27, 2010

How to finish any previous activity in application stack (at any level , I mean not immediate parent) , from current activity like on some particular event I want to invalidate this previous activity?

View 1 Replies View Related

Android :: Retain Only One Copy Of An Activity On Stack When Called From Non Activity

Jul 26, 2010

How can I make sure I only retain one copy of an activity on the stack when called from non-activity? When called from an activity I can just add the FLAG_ACTIVITY_REORDER_TO_FRONT flag to the Intent, but how can I do this from e.g. a widget or a notification?

View 1 Replies View Related

Android :: How To Clear All Activity In Stack Below Latest Activity?

Dec 22, 2009

All the current discussions involves clearing all activites above an existing activyt, but I'm trying to find a way to clear all the activities before the latest activity in the stack. So my scenario is A -> B -> C and then when a user goes to Activity D, activies A,B,C should be cleared from the activity stack. FLAG_ACTIVITY _CLEAR_TOP seems to only clear any activites above an existing activity. Anybody run into this scenario and found a solution?

View 4 Replies View Related

Android :: Clear Activity Stack And Replace With A New Activity

Sep 17, 2009

i want to clear the activity stack and replace it with a new activity as the root activity, even if that activity exists somewhere on the stack (or not). i see FLAG_ACTIVITY_CLEAR_TOP and FLAG_ACTIVITY_NEW_TASK, but it's not obvious to me how to use those in conjunction to achieve what I want. it's like i want to completely restart the task with some activity that i specify as the new root.

View 9 Replies View Related

Android :: Make A Particular Activity As A Root Activity In Stack

Aug 4, 2009

i have a set of activities on my stack Say A-->B-->C. when i launch the activity named 'D' it should get fired as the root activity of my application and all the other activities(A,B,C) should get cleared from my stack once Activity D is launched.Can any one tell me as how to do this

View 4 Replies View Related

Android :: Strange Activity Stack Behavior When Using Map Activity

Apr 23, 2010

I have the following activity structure in my application A simple "splash screen" activity is started when the application is fired up (let's call it "Splash"). This activity starts the main activity when the user presses a button (I will call it "Main"). Main can in turn start two activities from the menu. The first activity presents a simple form (let's call this one "Form"), the second is a MapActivity that presents a map (it is called "Map").
Main, Form, and Map are declared exactly the same in the manifest:
<activity android:name="fully qualified activity class"
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|orientation"
> <intent-filter>
<action android:name="android.intent.action.DEFAULT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter> </activity> When Main is active and I start Form and press "back", Main comes up again. Pressing "back" again brings up "Splash". Nothing strange here.Now comes the strange part: when I am in Main, start Map, and press "back", Main comes up as expected. But pressing "back" again just restarts Main. A second press on "back" is needed to bring me back to Splash!So it seems that starting the Map activity somehow results in Main ending up on the activity stack twice while starting the Form activity does not! Both Form and Map are started like this: start Activity(new Intent(this, MyActivity.class)); I don not catch the back key in any activity.Any clues on what is going on or how to debug this?

View 1 Replies View Related

Android :: Closing More Than One Activity In Activity Stack

Nov 4, 2009

I'm new android and i want to know how to remove more than one activity from stack. We use finish() for closing particular activity but i wanna close more than one activity underneath it, at a time.

View 2 Replies View Related

Android :: Way To Tell When Task Goes To Back Of Stack?

Mar 23, 2009

Is there a way to tell when my task gets put on the back of the UI stack (user pressed "home" say?) I have some resources I'd like to free when not foregrounded. The lifecycle routines seem dicey to use to try and infer this. The "home" key does not seem to be passed to onKeyDown(), and moveTaskToBack() is never called by the system so I can hook it. I can poll the ActivityManager for running activities with my task id, but hard to find a good time to call this.

View 5 Replies View Related

Android :: Clear Activity Stack?

Nov 3, 2009

Is there a way to clear our Activity stack? For example, a user in my app progresses through these activities, one is launched from the previous activity: ActivityA -> ActivityB -> ActivityC if the user is now looking at ActivityC, and they hit the back button, they will go back to ActivityB. Is it possible to add a menu to ActivityC where the user can clear their activity stack, and then launch a new instance of ActivityA? This would be so the user can jump to a particular activity in my application without getting confused with the back button + history,

View 4 Replies View Related

Android :: Activity Stack Not Preserved

Mar 10, 2010

My main activity A has as set android:launchMode="singleTask" in the manifest. Now, whenever I start another activity from there, e.g. B and press the HOME BUTTON on the phone to return to the home screen and then again go back to my app, either via pressing the app's button or pressing the HOME BUTTONlong to show my most recent apps it doesn't preserve my activity stack and returns straight to A instead of the expected activity B.Is there a setting I'm missing or is this a bug? If the latter, is there a workaround for this until the bug is fixed?

View 5 Replies View Related

Android :: Way To Navigate Up Activity Stack?

Sep 20, 2010

My understanding is to quit the app I need to call finish() on all activities up to the root activity. However, how do I navigate up activities in app activity stack from current active activity?

View 12 Replies View Related

Android :: Traversing Activity Stack

Sep 1, 2010

how can I assure I always go back clicking on custom menu option to previous activity. I think it is a good idea to start new activities by startActivity(context, XActivity.class) but then when option is selected I should call finish on that activity or again call startActivity(this, previousActivityName)?on the other hand android has all activities on a stack so clicking goback button on a phone I will always go back to previous view, so how can I get this stack.

View 6 Replies View Related

Android :: Removing Stack Of Activity

Jan 7, 2010

I have 5 Activities in sequence Activity1, Activity2, Activity3, Activity4, Activity5.When I am at Activity5 there is a button through I can go to Activity2.Means jump from 5 to 2 with removing the Activity3 & 4.How can I do that?

View 7 Replies View Related

Android :: Resetting Activity Stack

Sep 22, 2009

Activities: A & B are activities that once you have navigated away from them it's not logical that you can get back to them using the back button. C X are activities that follow the usual "can go back to where you came from" flow.App flow: * Launch app from Home -> starts A * From A start B * Finish A (removes it from stack) * From B start C * Finish B (removes it from stack) * From C start D * From D start E.Once the user has reached E, the activity stack looks like this: C -> D -> E. Can I somehow reset the whole stack so it starts again at A so it's as the user just launched it from Home (so that C... E are removed from the history stack)?

View 3 Replies View Related

Android :: Activity History Stack

Aug 1, 2009

I have 3 activities, I want to allow only one of each of the activities to be on the history stack at one time.A>B>C>[GO TO B] gives me A>C>B using FLAG_ACTIVITY_REORDER_TO_FRONT flag.Now the problem is that when I call B from C I want B to be restarted not just brought to the front.how can I do that?

View 3 Replies View Related

Android :: Is There Way To Print Activity Stack?

Dec 15, 2009

Actually I was trying to automate some stuff on my android emulator. I start an activity through adb shell using "am" command, but when the activity starts do I have a way out to know that my activity is the one which is at the top & has the focus.I googled about it a lot but couldn't find the right way to do this.

View 2 Replies View Related

Android :: Not Understanding Activity Stack?

Dec 3, 2009

I'm having trouble with my activities when they go in the background. I have two activities, A and B. Only A can launch B (manifest copied below).This is very confusing. It's like Android knows my app is running, and puts a new instance of A on top of the old B instance running. I'd just expect that the application gets paused in-place, and whenever the user hits the app icon again, it just picks up where it left off (in this case, just show B again!) Below is the manifest, and the activity classes for this test are completely empty (except A which has a button to launch B).

View 4 Replies View Related

Android :: How To Reuse Activity On Top Of Stack

Jun 16, 2010

My app has a single entry activity called "Main". In "Main" I call one of three other activities A, B, or C (based on a preference) and then immediately exit/finish"Main" so that only A, B, or C are active.I also have a permanent notification in the notification bar that users can pull down (at any time) to conveniently restart my App (calls intent with "Main" component).The problem is that if my app is already running and users pull down the notification and restart, I get A or B or C running on top of the previous activity (also A, or B, or C). How can I avoid this (i.e. reuse the activity on top of the stack)?I've tried Intent.FLAG_ACTIVITY_* and nothing seems to work. I've tried launchModel in the Manifest and it also didn't seem to work.

View 1 Replies View Related

Android :: Access Activity Below In Stack

Sep 8, 2010

I have pushed one Activity to make few changes. Now I want to pass all the changes to the previous(below) Activity. I dont want to create Activity again;and intead i want to access the previous activity.

View 1 Replies View Related

Android :: Is There Way To Vizualise The Activity Stack?

Apr 7, 2010

Is there a way to vizualise the activity stack, at some moment during debug, or normal run ?

View 3 Replies View Related

Android :: How To Clear Activity Stack In Task

Jan 6, 2010

I have three activities. Activity A start activity B by the method startActivityForResult, and Activity B start activity C by the method startActivity. Then, after starting activity C, activity B kill himself by finish(). Now the task stack stored two activities: A and C. My question is: how can I finish activity A when I finish activity C. or how can I clear the whole stack of the task.

View 5 Replies View Related

Android :: View Task's Activity Stack

Mar 14, 2010

I just started developing a simple Android application while I'm still learning its platform. I'm using Eclipse IDE with the ADT plugin 0.9.6 and I need to know if it's possible to view the activity stack that is associated with a Task. Is there any way through the DDMS tool or through any other technique?

View 4 Replies View Related

Android :: SingleTask Really Always At Root Of Activity Stack?

Sep 16, 2009

In the documentation it is stated that an activity with launchMode="singleTask" is always at the root of the sctivity stack. However, when I run my "singleTask" activity for a few scenarios and monitors behaviour with "adb shell dumpsys activity" I can see it placed both at the top of the stack (with numActivities=2) and in the middle of the stack (with numActivities=3). The activity at the root (frontOfTask=True) has a "normal" launchMode.Is the documentation incorrect or am I missing something?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved