Created
January 29, 2019 02:51
-
-
Save princessdharmy/0356d0b9e7e8f6207b6bbd3e2c27c58c 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 BaseActivity<T extends ViewModel> extends DaggerAppCompatActivity { | |
private T viewModel; | |
/** | |
* | |
* @return view model instance | |
*/ | |
public abstract T getViewModel(); | |
@Override | |
protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
this.viewModel = viewModel == null ? getViewModel() : viewModel; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment