Android-CleanArchitecture
Android-CleanArchitecture copied to clipboard
NullPointerException on UserListFragment activity recreated
Hi All
I have encountered a problem when you activate the activity kill a null pointer exception occurs, I put into practice what is advised in this web https://medium.com/inspace-labs-blog/efficient-and-bug-free- fragment-injection-in-android-mvp-applications-1245a3dd5a9 # .u91v46vvs
But I encounter the problem that the fragment in the onCreateView not have injected dependencies.
Another approach is to change the order of the super and put it above the method onCreate
@Override
protected void onCreate(Bundle savedInstanceState) {
this.getApplicationComponent().inject(this);
super.onCreate(savedInstanceState);
}
What would be the optimal way to solve this problem?
It does not seem right that when the activity is created to use my presenter and when it can not use recreates prevents me put code in the onCreateView the fragment.