fragment-backstack

Fragment onResume() and backStack issue

社会主义新天地 提交于 2019-12-12 11:53:10
问题 I am stuck with situation for resuming my fragment when I am coming back from another fragment. Scenario : I have a Fragment A . Now I am opening multiple fragment with in Fragment A say : A1, A2, A3 ... using a frame layout. Now I am initiating a new Fragment say Fragment B from one of A1/A2/A3 ... I am performing some action over Fragment B and now when I Pop Out my Fragment B then I am not able to get onResume() of Fragment A Just need to get onResume() while I get back from Fragment B Any

How do I clear EditText after all fragments above it have been popped?

ε祈祈猫儿з 提交于 2019-12-12 05:29:04
问题 In an Android project, I have 3 fragments, and I navigate through them during an operation the user does. FragmentA -> FragmentB -> FragmentC When the user finishes the operation, I do a popBackStack to return to FragmentA if(getFragmentManager()!=null) if(getFragmentManager().getBackStackEntryCount()>0) { getFragmentManager().popBackStack(getFragmentManager() .getBackStackEntryAt(0) .getName(), FragmentManager.POP_BACK_STACK_INCLUSIVE); } My question is: I have an EditText , where the user

Handling fragment backstack in Navigation drawer

﹥>﹥吖頭↗ 提交于 2019-12-12 01:28:53
问题 okay i know there are other questions that on first glance make this one look like a duplicate, but none of these answers work in my case, What i want is the first fragment displayed to be like a Main Activity in respect to how the back button works, i need whichever fragment i choose from my navigation drawer to go back to the first fragment when the back button is pressed then a user would quit the app by pressing it again. So ive tried using addToBackStack and when i move to another

Manage the backstack in android

老子叫甜甜 提交于 2019-12-11 14:03:25
问题 Currently the structure of the android app is Home About us Products product1 product2 product3 Contact us As there is a side-menu and I can access the product 1 directly, My current attempt is add to backstack for every transaction,and it has a behavior that is quite strange If I go into like this: Home->product1->About us The flow is after I enter the home page, I click on the product1 on the side menu, after enter product1 page click on the about us on the side menu 1st time press back

RuntimeException in one case. NullExeption - getBackStackCount()

不羁的心 提交于 2019-12-11 11:32:42
问题 Only when my app was off (freed resourses for other apps) and when i again opened it, i got this exaption. If i myself closed app, all it worked. 11-10 22:00:10.007 6255-6255/com.john.testOne E/AndroidRuntime: FATAL EXCEPTION: main 11-10 22:00:10.007 6255-6255/com.john.testOne E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.john.testOne/com.john.testOne.StartPageActivity}: java.lang.NullPointerException 11-10 22:00:10.007 6255-6255/com.john.testOne E

Android, notify backstack fragments on some change

戏子无情 提交于 2019-12-11 08:53:49
问题 What is the best practice to notify all the fragments that are in backstack on some change? I try to use EventBus and every Fragment subscribe to the event, then when change is happening the main activity send post event to all the subscribers. Only onDestroy I Unsubscribe the destroyed fragment. I don't like this solution because if there are many fragments in backstack, it can be heavy + lots of listeners simultany. my application, has infinity drill down, from one fragment you replace to

Implementing back stacks with fragments

烂漫一生 提交于 2019-12-11 01:05:27
问题 I'm attempting to implement a back stack while using fragments, but when using the Back button, I keep getting taken out of the app to the home screen. Activity opens fragment A; Fragment A has a clickable TextView that opens fragment B (this works). Hitting BACK should return me to fragment A, but it takes me to the home screen instead. Here is the activity's call to the opening of fragment A in onCreate : FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction

putFragment() - Fragment x is not currently in the FragmentManager

徘徊边缘 提交于 2019-12-10 16:16:51
问题 The above title has been asked a lot, but answers seem closely tied to FragmentStatePagerAdapter which has nothing to do with my problem. I'm using the method putFragment(Bundle, String, Fragment) directly. The Android Documentation for putFragment(Bundle, String, Fragment) says: Put a reference to a fragment in a Bundle. This Bundle can be persisted as saved state, and when later restoring getFragment(Bundle, String) will return the current instance of the same fragment. Parameters * bundle

How to copy YouTube's app navigation logic

丶灬走出姿态 提交于 2019-12-09 02:23:31
问题 I want to implement in my app navigation logic like in Youtube app. (BottomNavigationView + Fragment management). I want this, because these fragments are heavy, so I want them to be lazy initialized and then stored in backstack, I feel like YouTube is doing it this way. I have implemented BottomNagivationView but I have problems with Fragment Management. My code: bottomNavigationView.setOnTabSelectedListener { position, _ -> setFragment(OnlinePageFragment.Page.values()[position]) } where

Android - Back button and fragment backstack not working

有些话、适合烂在心里 提交于 2019-12-04 12:01:50
问题 I'm developing a simple fragment-based application with a singe FragmentActivity. Each 'screen' of the application is contained in a fragment and all fragments are added to the container layout at application startup. // Set up fragments in Main Activity fragMan = getFragmentManager(); FragmentTransaction ft = fragMan.beginTransaction(); ft.add(R.id.fragment_container, settingsFragment); ft.add(R.id.fragment_container, mapFragment); ft.add(R.id.fragment_container, tracksFragment); ft.add(R.id