activity-stack

Activity in background gets killed when Home button is pressed

柔情痞子 提交于 2021-02-11 13:10:13
问题 I encountered strange problem, lets say I have two activities A and B, app starts with Activity A, I proceed to activity B press Android Home Button, return to app which brings me back to Activity B. Then I press Back button (either hardware on in toolbar) and this closes app, but it should return me to Activity A. Activity B has no override of onBackPressed and has Activity A stated as PARENT_ACTIVITY in manifest. I'm starting it with Intent with no flags. Any idea why this happens ? Thanks

Clear activity stack in android

旧城冷巷雨未停 提交于 2020-01-12 11:51:11
问题 I have a LoginActivity as my launcher screen. And SettingsActivity as my fifth screen . I have a logout button in settings screen. On clcik of this button, how can i go to Screen-1 (i.e LoginActivity) by clearing all remaining activities (i.e 2nd, 3rd, 4th) from activity stack? Note : i have finished LoginActivity but not remaining activities. Thanks in advance 回答1: Simple, set an onclick on your logout button and then add this to your intent: Intent newIntent = new Intent(this, login.class);

How to see the activity stack in debug?

半腔热情 提交于 2020-01-12 03:29:07
问题 I have a problem that one of my activities is popping out after I think I finished it. Is there a way to see the stack of the activities? 回答1: 1-You can use Hierarchy Viewer within Eclipse .You can see all connected devices and emulators and the activity stack . And in addition in the tree view you can see much more information about the view itself: 2-From the command line , you can use this: adb shell dumpsys activity .This asks the activity manager to print a dump of its current state. The

Finish All Instance of particular Activity

泄露秘密 提交于 2019-12-22 05:11:44
问题 There can be many activities in application and the last launched activity stay on top of stack and on pressing back it finish the current activity.I have a sequence of Activity and here is the flow .. if we have A,B, C(1) ,D, C(2) ... Activity C(1) and C(2) are two different instance of Activity C launched while navigating the application .So what is requisite is to clear all the instance of activity C and the result should be when I finish C(2) I should have left with these stack A,B,D .

Finish All Instance of particular Activity

妖精的绣舞 提交于 2019-12-22 05:11:29
问题 There can be many activities in application and the last launched activity stay on top of stack and on pressing back it finish the current activity.I have a sequence of Activity and here is the flow .. if we have A,B, C(1) ,D, C(2) ... Activity C(1) and C(2) are two different instance of Activity C launched while navigating the application .So what is requisite is to clear all the instance of activity C and the result should be when I finish C(2) I should have left with these stack A,B,D .

how to finish all activities and close the application in android?

ⅰ亾dé卋堺 提交于 2019-12-18 18:39:56
问题 My application has the following flow: Home->screen 1->screen 2->screen 3->screen 4->screen 5>Home->screen 2->Home->Screen 3 My problem is that when I am trying to close the application then Home activity opens everytime when I am trying to close the application. I just want to close the application when user presses the back key of device on home screen. 回答1: There is finishAffinity() method that will finish the current activity and all parent activities, but it works only in Android 4.1 or

Activity restarts on Force Close

空扰寡人 提交于 2019-12-17 16:08:12
问题 I have an Application with a single root Activity. I've recently had it brought to my attention that any kind of Force Close on my Activity results in it restarting and I have no idea why this might happen. If I force an uncaught exception or use the 'long back press to force close' option, they both result in the same. My only guess would have been some form of quirk relating to retained references to some part of the Activity, only I don't have any outside of some WeakReference entries at

How to prevent going back to the previous activity?

荒凉一梦 提交于 2019-12-17 06:21:33
问题 When the BACK button is pressed on the phone, I want to prevent a specific activity from returning to its previous one. Specifically, I have login and sign up screens, both start a new activity called HomeScreen when successful login/signup occurs. Once HomeScreen is started, I want to prevent the users from being able to return to the login or sign up screens by pressing the BACK key. I tried using Intent.FLAG_ACTIVITY_NO_HISTORY , but since the application has Facebook integration, when the

How to prevent going back to the previous activity?

☆樱花仙子☆ 提交于 2019-12-17 06:21:13
问题 When the BACK button is pressed on the phone, I want to prevent a specific activity from returning to its previous one. Specifically, I have login and sign up screens, both start a new activity called HomeScreen when successful login/signup occurs. Once HomeScreen is started, I want to prevent the users from being able to return to the login or sign up screens by pressing the BACK key. I tried using Intent.FLAG_ACTIVITY_NO_HISTORY , but since the application has Facebook integration, when the

Android: bug in launchMode=“singleTask”? -> activity stack not preserved

橙三吉。 提交于 2019-12-17 02:27:08
问题 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 BUTTON long to show my most recent apps it doesn't preserve my activity stack and returns straight to A instead of the expected activity B . Here the two behaviors: Expected: A > B > HOME > B Actual: