fragment-lifecycle Questions
4
I'm using the Jetpack Navigation Component in my project with a single activity and some fragments.
I have a fragment with a list that fills from server side. I call getDataFromServer on the onVie...
Orvie asked 6/2, 2019 at 12:9
5
Solved
Why getContext() sometimes returns null? I pass context to LastNewsRVAdapter.java as an argument. But LayoutInflater.from(context) sometimes crashes. I'm getting a few crash reports on play console...
Heavyfooted asked 27/12, 2017 at 6:49
2
Solved
I need to get the LifecycleOwner to pass it in my FirestoreRecyclerViewOption but Fragment doesn't implement Lifecycle.
So, how to get that?
My Fragment implements LifecycleOnwer as shown in the ...
Mme asked 17/10, 2019 at 18:44
4
My ViewModel class implements LifecycleObserver.
When I call fragment.lifecycle.addObserver(this) it produces exception.
Caused by: java.lang.IllegalArgumentException: The observer class has som...
Teferi asked 6/2, 2019 at 14:20
3
Solved
I created a demo to understand which all fragment lifecycle's methods are called during different cases of fragment transaction.While most of the calls are as per expectation few things I am still ...
Chellean asked 14/2, 2017 at 5:28
3
Solved
What are the differences between onCreate(), onCreateView(), and onActivityCreated() in fragments and what would they each be used for?
Decretory asked 8/3, 2015 at 17:33
4
I have a single Activity application with multiple Fragments that are being switched by using Navigation components. When I switch between two fragments their onCreate() and onDestroy() methods see...
androidandroid-architecture-componentsandroid-jetpackandroid-architecture-navigationfragment-lifecycle
Urquhart asked 3/7, 2018 at 14:35
2
Solved
I'm using a navigation-component in my application and also using shared ViewModel between multiple fragments that are in the same graph. Now I want to instantiate the ViewModel with this graph sco...
Venditti asked 18/12, 2019 at 8:36
2
Solved
I'm using ViewPager 2 from AndroidX with 4 instances of the same fragment. My question is pretty straight forward. When I'm navigating to some another fragment(using navigation drawer or even somet...
Mahaliamahan asked 13/11, 2019 at 20:23
4
I have a lifecycle aware fragment and a LifecycleObserver class
public class MyFragment extends Fragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(...
Poundfoolish asked 3/11, 2017 at 9:0
2
I have a SearchFragment class which extends a class called BaseFragment in which onResume and onStop are overridden as below:
@Override
public void onResume() {
checkEventBusRegistration();
supe...
Attract asked 11/3, 2019 at 9:46
4
My APP does have multiple fragments and activities, Most of these activities hold different fragment, This is to make my components reusable easily. I am facing an issues when I'm loading other act...
Expulsion asked 2/4, 2018 at 8:31
1
I am trying to retrieve the fragment from the backstack. It is getting retrieved but the issue is that on pressing the back button the oncreate view and subsequent lifecyce methods of current fragm...
Enthalpy asked 22/3, 2017 at 3:43
2
I am building an application which is related to google maps. In this i am trying to implement the map in fragment. I am manipulating the map in OnMapReady method. But app is not calling the OnMapR...
Winterfeed asked 16/9, 2016 at 20:28
3
Solved
Background
I have a larger application in which I had/have several problems with new Google Maps API. I tried to describe it in a different question but since it seems too complex I decided to sta...
Scarlatti asked 26/4, 2013 at 12:26
2
Solved
SaveInstanceState
For data like Integer, Long, String and else are fine, I just put it in the bundle and get it back once the onCreateView gets called again. But my fragment also has listener like...
Oriole asked 10/1, 2014 at 11:27
1
Solved
I am looking at the Fragment's Lifecycle here but cannot see where onActivityCreated gets called?
Anubis asked 6/7, 2015 at 3:13
2
Solved
Short Version:
I have an Activity that has a ViewPager. The ViewPager has three fragments inside it. I am storing the data inside the fragments by implementing Parcelable and storing it inside the...
Heteronym asked 23/6, 2015 at 21:38
4
Solved
I have a Fragment which sets up a ListView and creates a Handler to update the Listview periodically. However, it looks like the Handler still runs after the Fragment has been destroyed.
The foll...
Fluted asked 21/4, 2015 at 13:43
2
Solved
I am wondering what the proper order goes when a user returns to an Activity from the Home Screen.
Will the Activity's onResume() execute first, and then the Fragment's onResume() execute after? D...
Igal asked 27/2, 2015 at 2:35
3
Solved
I have an 'Activity A' which host a 'Fragment B'. Please confirm that if I call A.finish() then 'fragment B 'gets destroyed. The fragment B would already be added to the fragment manager. I realize...
Gentile asked 20/8, 2014 at 20:36
2
My program has 6 fragments: Fragment1, Fragment2,....->Fragment6.
I use the add() and replace() statement to switch between the fragment and track their lifecycle.
Fragment1 add Fragment2 add Fra...
Temptation asked 17/11, 2013 at 14:54
2
Solved
I have 4 fragments. I switch among them by using hide/show transactions. One of them may have nested fragments which are added by replace transaction. The issue is that if I add a nested fragment h...
Veil asked 10/12, 2013 at 10:48
1
Solved
I am using Otto Event bus to subscribe to certain events in a ListFragment. The bus instance is stored and created in an subclass of Application, in other words, it bus should work as a singleton. ...
Rainie asked 30/10, 2013 at 19:59
1
© 2022 - 2024 — McMap. All rights reserved.