back-stack

'FLAG_ACTIVITY_REORDER_TO_FRONT' in new flavors of Android OS(4.4 & later)

半腔热情 提交于 2019-12-08 05:13:50
问题 Recently, I faced a problem to re-initiate Activity that's already in back-stack. The flag FLAG_ACTIVITY_REORDER_TO_FRONT is the best solution for manage this problem. But in Android 4.4 & later it isn't work well(some times Activity view is getting freezes or Application minimizes itself, menu isn't inflated to re-initiated Activity or Keyboard isn't allow to enter something to text area) but in previous versions this flag re-initiate's the Activity, and removed from back stack. Please

Android: how to return to Activity with “noHistory” attribute after onStop?

一个人想着一个人 提交于 2019-12-07 10:08:46
问题 I was looking for a way to delete a certain activity from history stack, and found a solution here (Wakkas's anwer). However, if I close the app with this activity opened e.g. by pressing the home button, and later return to it, the activity is not restored. If I remove the "noHistory" attribute, it is coming back and also restored after a kill. Is there a way to make it not appear on the history stack (= don't want to come back to it by pressing the back button in next activity) without this

Android: access the Activity stack programmatically

丶灬走出姿态 提交于 2019-12-07 05:09:53
问题 is it possibile to get the current Activity stack from code? Here is my use case: the user navigates from Activity to Activity A -> B -> c -> D -> ... some of the Activity will finish after sending the user to the new screen, some others won't I need to check if pressing the BACK button will bring the user to the Activity A or any other because in the currently shown Activity I have a button that finishes the Activity and the icon of the button is different weather you'll be taken to tha

Trying avoid add same fragment twice to backStack, popBackStackImmediate always return false

旧巷老猫 提交于 2019-12-07 02:38:05
问题 I'm trying avoid adding the same fragment to backStack with this method: public static void replaceFragment(FragmentManager fragmentManager, Fragment fragment, Boolean addToBackStack) { String backStateName = fragment.getClass().getName(); boolean fragmentPopped = fragmentManager.popBackStackImmediate(backStateName, 0); if (addToBackStack && !fragmentPopped && fragmentManager.findFragmentByTag(backStateName) == null) { fragmentManager .beginTransaction() // .setCustomAnimations(android.R.anim

Pressing back does not return to previous fragment

℡╲_俬逩灬. 提交于 2019-12-06 22:56:07
问题 I have a problem with adding the fragment transactions to the back stack. I have a Main activity in which I populate my layout with a Menu Fragment: public class MainActivity extends ActionBarActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); getFragmentManager().beginTransaction().add(R.id.frag_container, new MainMenuFragment()).commit(); } @Override public boolean onCreateOptionsMenu(Menu menu)

how to show hide a fragment?

半腔热情 提交于 2019-12-06 15:37:25
I have a Activity with four buttons at the bottom like tabs. By pressing any button a new Fragment is displayed in the FrameLayout above these buttons like we do in TabActivity. See My Problem here .Now i think i should find a way to hide and show those fragments. Kindly tell me how can i show and hide a fragment without reloading it again. Main Purpose of showing hiding a fragment is to maintain its current state. In one of my fragment i have an AsyncTask whenever i switch between fragment it call that AsynTask again. // to show fragment when it is hidden FragmentManager fm =

Fragments Behave Weirdly When Using addToBackStack()

我是研究僧i 提交于 2019-12-06 12:47:52
问题 An SSCCE for this issue is available on GitHub. For future readers, the original example is on a branch of the same project, and the fix is available in this diff. This SSCCE has a ListView and a row of buttons. The buttons are supposed to change the data in the ListView, and the listView rows (when clicked) are supposed to open a new fragment and advance the backstack while staying in the same activity. If do the following things, it produces the following result: Open the app. Tap the

Go back to different Activity in back stack in Android

风格不统一 提交于 2019-12-06 08:09:44
问题 Say I have an activity stack as such: A -> B -> C -> D I would like to create a new activity "E", and end up with a stack like this: A -> B -> E Basically, upon hitting the back button in activity D, I need to swap out activity C for activity E, and land on it. Is this possible? Or should I be structuring the navigation differently somehow? Thanks! 回答1: so while going from activity C to D finish(); C activity. At last at backPress method of Activity D call activity E and finish(); Activity D

Change the z-order of activity animations on Android

寵の児 提交于 2019-12-06 05:52:49
问题 Is there a way how to invert the z-order of activity animations? Basically when you start new activity it is added to the backstack and its window is added over the window of the previous activity. When returning back sometimes later the activity which which is taken from the backstack show its window underneath the top activity. Most time it makes completely sense, but I have a following issue with that behavior. I have a widget which points somewhere deep into the app structure. So I have

Intent.FLAG_ACTIVITY_CLEAR_TOP not working

半腔热情 提交于 2019-12-06 03:44:09
问题 My Application Flow: Login->Profile->UpdateProfile->ChangePass All of my activitys extends FragmentActivity When I press button in ChangePass Activity I call this code: Intent intent=new Intent(getApplicationContext(),LoginActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); So It should start LoginActivity and when I press back from LoginActivity then Application should close...But When I press back button from Login Activity the flow is: ChangePass-