back-stack

Android back-stack not being created from Notification PendingIntent

南笙酒味 提交于 2019-12-06 00:43:37
问题 I'm having issue if the app isn't in memory when the notification is followed. The backstack won't be created. I've followed the steps according to the developers guide. Please show me the bit I've missed otherwise I'll have to route all intents through my HomeActivity in order to create the backstack manually on following intent. AndroidManifest.xml : <activity android:name=".activity.HomeActivity" android:clearTaskOnLaunch="true" android:configChanges="orientation|keyboard|keyboardHidden

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

非 Y 不嫁゛ 提交于 2019-12-05 17:59:24
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 behavior? Kind regards, jellyfish I don't think so - leaving the activity via the "Home" button and

Android: access the Activity stack programmatically

只谈情不闲聊 提交于 2019-12-05 11:17:00
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 Activity A or another Activity. Thanks in advance, Bye, Maurizio My impression is that the answer to the

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

廉价感情. 提交于 2019-12-05 08:21:24
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.slide_in_left, android.R.anim.slide_out_right, android.R.anim.fade_in, android.R.anim.fade_out)

The fragment which is got from backstack, call onCreateView() again

梦想的初衷 提交于 2019-12-05 05:35:10
Please help me resolve my issue. I have MainActivity with a framelayout. I want to replace some fragments into the framelayout. Now I am encounering an issues, it's: 1) I created and put fragment A to framelayout. Fragment A called onCreateView ...etc. 2) Then I created and put fragment B to layout... Fragment A was put on backstack and it called onPause() (not called onDeattach() , onDestroy ...) 3) I pressed back button. Fragment A was got from backstack, but it called onCreateView() again. This action make my app has some another issues. So my question is how to store fragment A in

Pressing back does not return to previous fragment

我怕爱的太早我们不能终老 提交于 2019-12-05 04:50:43
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) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R

Android onConfigurationChanged: how to save and restore fragment back stack?

折月煮酒 提交于 2019-12-05 03:22:13
I have an activity with a dual pane: a list of menu items on the left (fragment M) and details of the currently selected item on the right (fragment D). When the user selects an item in fragment D, fragment D gets replaced with another fragment (let's call it D1). When the user selects an item in fragment D1, fragment D1 gets replaced with another fragment (let's call it D2), and so on. Of course, when the user presses the back button she can go back in the fragments history: D2->D1->D. My problem is: how can I save and restore the full fragment back stack upon configuration change (in

How to handle back button using view pager?

冷暖自知 提交于 2019-12-05 02:19:36
I am having two fragments Frag A and Frag B which are rendered using view pager . If user has swiped from A to B then presses back button(when in B) then user should go to A instead of coming out of view pager . How can we achieve this ? Adding transaction to backstack does not seem to help . Thanks You have to override the onKeyDown() method in the Activity . @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { myViewPager.setCurrentItem(0, true); return true; } else { return super.onKeyDown(keyCode, event); } } This will capture the "back"

Fragments Behave Weirdly When Using addToBackStack()

旧时模样 提交于 2019-12-04 20:53:19
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 ListView. - FragmentTransaction.replace(...) with addToBackStack(true) Tap any of the buttons. -

Android : Return to previous fragment on back press

為{幸葍}努か 提交于 2019-12-04 16:58:00
问题 I have implemented Navigation Drawer which is a subclass of Activity. I have many fragments in my application. My question goes here Imagine there are 3 fragments : Fragment_1 : Fragment_2 : Fragment_3 When I start my application, Fragment_1 is loaded When I click on some components on Fragment_1, I'm navigated to Fragment_2 and so on.. So it's like Fragment_1 > Fragment_2 > Fragment_3 When I press back key from Fragment_2, I'm navigated back to Fragment_1 But when I press back key from