Created
January 29, 2019 02:56
-
-
Save princessdharmy/0572b3f2495333fc94d3e21b66b45788 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseFragment<T extends ViewModel> extends DaggerFragment { | |
private T viewModel; | |
/** | |
* | |
* @return view model instance | |
*/ | |
public abstract T getViewModel(); | |
@Override | |
public void onAttach(Context context) { | |
super.onAttach(context); | |
viewModel = getViewModel(); | |
} | |
@Override | |
public void onDetach() { | |
super.onDetach(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment