Android :: Start Activity And Clear Activity History

Apr 22, 2010

I have a huge maze of activities in my application. What I need to do, is that when the user logs in into the system, the activity history should be cleared. I cant just use finish() when I start a new activity, because I want the activities to have a history until the user logs in. I have experimentet with the different flags when starting an activity, but I have had no success.

Android :: Start Activity and clear activity history


Android :: Clear Entire History Stack And Start A New Activity On Android

Aug 13, 2010

Is it possible to start an activity on the stack, clearing the entire history before it? The situation I have an activity stack that either goes A->B->C or B->C (screen A selects the users token, but many users only have a single token). In screen C the user may take an action which makes screen B invalid, so the application wants to take them to screen A, regardless of whether it is already in the stack. Screen A should then be the only item on the stack in my application. Notes There are many other similar questions, but I haven't found anything that answers this exact question. I tried calling getParent().finish() - this always results in a null pointer exception. FLAG_ACTIVITY_CLEAR_TOP only works if the activity is already on the stack.

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 :: Opening Browser Activity / Prevent It From Being In Activity History

Aug 12, 2010

I'm working on an app that launches the browser activity to perform a Twitter OAuth authorization. This process uses a callback url which will re-launch the activity that started the browser activity in the first place.My problem is that the browser pages remain in the history stack and when the user then clicks back from the preferences activity that launched the browser in the first place, they don't go back to the app's main activity, but instead are brought back to the browser. I've tried adding flags to the launching intent to prevent history and reset on clear, but it doesn't seem to work when running on my phone, only on the emulators.

View 1 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 :: How To Clear Activity From Second Activity Going Back To Home Screen?

Mar 3, 2010

example scenario is: from login screen - main screen - then when i clicked a hide button the app will go to home screen, and when im going to click the app again the main screen would be called.

View 2 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 :: Start An Activity And Return Back To Original Activity

Jan 26, 2009

I have an application with contains multiple activities. The main activity will start the others ( use startActivity() ) depends on user event, when an activity close, it calls finish() and return back to main activity. It appears to behavior like that.

However, the "problem" I see is main activity's onCreate function is called every time. I think the the main activity should be placed in the activity stack and simply push to front when others exit, therefore only onResume, onStart are called. Is there some flag I need to set or I misunderstand the activity behaviro?

In child activity, besides calling finish() or startActivity for main activity, what is other way to move main activity to front?

View 2 Replies View Related

Android :: Start Activity When Main Activity Is Running In Background

Jan 10, 2010

I created an application which enables the user to set whether he wants to receive notification while the application runs in background mode. If the notifications are enabled an activity should be started (the dialog should appear on the screen).

I tried to enabled it the following way:

CODE:...........

This is the method from main activity. When onPause() is executed isRunningInBackground is set true.
When I tried to debug it when the main application was running in the background the line

startActivity(intent) had no effect (the activity didn't appear).

Does anyone know how to midify the logic in order to start an activity from the main activity when the main activity is running in the background (after onPause() is called)?

View 1 Replies View Related

Android :: Start An Activity In Different Apk Using StartActivity - Using The Activity Name Or Similar

Apr 20, 2010

I have tried to write an Android application with an activity that should be launched from a different application. It is not a content provider, just an app with a gui that should not be listed among the installed applications. I have tried the code examples here and it seems to be quite easy to launch existing providers and so on, but I fail to figure out how to just write a "hidden" app and launch it from a different one.

The basic use case is:

App A is a normal apk launchable from the application list.

App B is a different apk with known package and activity names, but is is not visible or launchable from the application list.

App A launches app B using the package and class names (or perhaps a URI constructed from these?).

I fail in the third step. Is it possible to do this?

View 3 Replies View Related

Android :: Activity Check Service To Start Another Activity

Sep 10, 2010

I need to made an activity (without layout) that on start check if a service is running. if it is true it starts Activity2, if it false it starts Activity1.

I tried with this code:

CODE:............

Enter code here

But when I check, in the onCreate method, if serviceConnect!=null I receive sometime a NullPointerExcption.

I tried also to insert the operation in the method onCreate in an Async Task:

CODE:............

View 2 Replies View Related

Android :: Start A New Activity From Anther Activity

Nov 19, 2010

I want to start a new activity from ab activity that (extends from Linearlayout) .. but this code is not right

CODE:..........

public class SearchResultForm extends LinearLayout{ ...

And i get this error ..

No enclosing instance of the type SearchResultForm is accessible in scope.

View 4 Replies View Related

Android :: Start An Activity From Non Activity Class

Aug 19, 2009

An activity can be called from existing activity through *startActivity(intent); *

Is t possible to call an activity from non Activity class ? and how?

View 2 Replies View Related

Android :: Start A Map Activity From Other Activity

Apr 8, 2010

I am developing an aplication. This one is designed to login a user, then select how find a place, using simple data or using a map. When I try to set in the event OnClick for select the "Map way" (using intent):

startActivity(new Intent(getApplicationContext(), MapviewController.class));

I have problems and didn't work.

My class and manifest are:

CODE:...........

Do you know any way to call the MapActivity from other?

View 3 Replies View Related

Android :: How To Add Activity To App To Task History?

Mar 16, 2009

I'm trying to write a mediaplayer activity launched from browser. But I found if I launch mediaplayer activity from browser, it won't be shown in the task history window(long press home key). And if I launch mediaplayer activity launched from home, it can be shown in the task history window. Is there any way to make mediaplayer activity to be shown in the task history window when launching it from the browser activity?

View 2 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 :: Avoid History Of Activity?

Oct 13, 2010

I have total 3 activities.
First activity(A) starts second activity(B). From Activity B, 3rd activity(C) is called.

Activity B, shows list with checkbox to select items and single OK button. On clicking OK button Activity C is called with selection.

When user clicks BACK button in Activity C, by default Activity B is displayed (with selected checkbox).

I want to display Activity A when BACK button is clicked in Activity C.

How to achieve that?

I have handled OnKeyDown() in Activity C to startactivity(A). it is working. But when user clicks BACK button on Activity A, again Activity C is displayed. while application should end.

In this direction how to skip Activity B is ever called?

View 1 Replies View Related

Android :: Enumerate Activity History Stack

Dec 17, 2009

When debugging I've sometimes wanted a tool that would list running tasks and show which activities are on the history stack for each task. I can get a list of tasks by calling ActivityManager.getRunningTasks(). Each ActivityManager.RunningTaskInfo object in the list gives me interesting information such as the base activity, top activity, and number of activities in the task. I haven't found a way to actually enumerate all the activities in the task's history stack. Is there a way to get at such information?

View 2 Replies View Related

Android :: Remove An Activity From History Stack

Dec 14, 2009

My app shows a signup activity the first time the user runs the app, looks like:

ActivitySplashScreen (welcome to game, sign up for an account?)
ActivitySplashScreenSignUp (great, fill in this info)
ActivityGameMain (main game screen)

so the activities launch each other in exactly that order, when the user clicks through a button on each screen.

When the user goes from activity #2 to #3, is it possible to wipe #1 and #2 off the history stack completely? I'd like it so that if the user is at #3, and hits the back button, they just go to the homescreen, instead of back to the splash screen.

I think I can accomplish this with tasks (ie. start a new task on #3) but wanted to see if there was simpler method.

View 3 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 :: Check If Any Items On History / Activity Stack?

Nov 16, 2009

I'm trying to figure out if there's any way to see if there is anything on the history stack so I can programatically display a Back button or not.

I tried getting the RunningTaskInfo to get the num of activities but it doesn't seem to work quite right for what I need. Does anyone know of another way?

View 2 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 :: How To Clear Notification If Activity Crashes?

Oct 26, 2010

In my app, I'm creating a notification with the FLAG_ONGOING_EVENT flag set.I'm cancelling the notification in onDestroy, but if my app crashes before calling onDestroy, is there any way to have my notification go away?

View 2 Replies View Related

Android : How To Clear Intent That Started Activity?

Jun 30, 2010

At the beginning Activity is launched by an Intent and something is done with this Intent. When I change orientation of my Activity, it's reloaded again and Intent is passed to the Activity. How can I clear that Intent to prevent Activity from using it again?

View 1 Replies View Related

Android :: Activity History Stack Wrong Upon First Install On Device

Dec 4, 2009

Edit / Update:

As an update to the below problem, I found the exact action which causes it to happen.

Download an apk from a url through the android browser
Install the app.
After install, the app gives you two choices: "Open" or "Done".
If you choose "Open", the quirky behavior described below starts.
If you choose "Done", then launch the app from the app tray, it works fine.

So it seems like this problem is caused by using the "Open" button the browser provides you after installing the APK.

I'm experiencing an error in the history stack of applications upon first install. I made a test app to demonstrate this.

The test app is simply two activities, A and B. Activity A launches B. That's all it does. Rest is wizard generated template code from eclipse.

When the user installs the app (via web url apk), and runs it for the first time, I get an out-of-order activity stack:

-User starts the app, A is on top.
-They make A launch B by clicking a button. B is on top of the stack.
-User hits the home screen button.
-User returns to the app, A is displayed, instead of B.
-User hits the back key, B is shown!
-User hits the back key again, A is shown!
-User hits the back key again, home screen shown.
-Now the stack is clean, and app behaves "normally" from now on!

Is any one else seeing this? This is almost exactly like this known bug, however my users are not installing from eclipse:
http://code.google.com/p/android/issues/detail?id=2373&q=first%20%20i...

I can provide the test app/source if anyone wants to try. This is the manifest, which does not have any special customizations made to it. code...

as far as I know, this should definitely not be happening, and works fine after you clear the history stack the first time.

View 1 Replies View Related

Android :: Prevent Saving Browser Pages In Activity Stack History?

Oct 27, 2010

1. User click one button on Activity#1 to start Activity#2.

2. One button on Activity#2 start system default browser(Intent.ACTION_VIEW) to get Twitter authorized.

3. After user allow, Twitter redirect user to Activity#2(Custom intent- filter+data) and it save the tokens.

Now, if I press back key, the app back to browser, how to prevent this and return to Activity#1? Try several Intent.Flag before start browser with no luck.

View 4 Replies View Related

Android :: Start New Activity In TAB

Jan 5, 2010

I am working on a travelling application and i am using tabs and each tab has an activity i.e world clock in one tab ,weather data in another tab and so on with in the weather tab i am displaying the users selected cities and the scenario is that when the user selects a city that city's forecast is to be displayed and later to view details as well which is in another activity . how can i launch this new activity from the already started activity with in the same tab ?

View 4 Replies View Related

Android :: Why Won't Activity Start

Sep 13, 2010

I'm trying to start an Activity with startActivityForResult, but I keep getting an ActivityNotFound exception, and I can't work out why. I've looked through the code multiple times, and it seems to be identical to some other, working code. Any suggestions?

The newNoteButton that starts the Activity:

CODE:...........

And the beginning of the TypyEdit Activity:

CODE:................

View 1 Replies View Related

Android :: How To Start An Activity

Sep 15, 2010

I have created two classes: Example1 and Example2, which extends activity.

Example1 contains a UI of buttons, while Example2 contains UI of TextEdit.

I want to call Example2 when a button is clicked, so this code is in an onclick method

Intent i = new Intent();
i.setClassName("com.a.ui", "com.a.ui.Example2");
startActivity(i);

So I am able to get the UI of Example2 successfully.

What's an alternate way of calling intent?

Is there any alternate way to start an activity?

View 2 Replies View Related







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