Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Strange way to get reference the Application #26

Open
ericntd opened this issue May 5, 2017 · 0 comments
Open

[Question] Strange way to get reference the Application #26

ericntd opened this issue May 5, 2017 · 0 comments

Comments

@ericntd
Copy link

ericntd commented May 5, 2017

Thanks for sharing this repo archi.

This is unlikely related to the MVVM design pattern but just want to make sure I'm not missing anything important.

Why do you do:
MainViewModel.java

private void loadGithubRepos(String username) {
   // ...
   ArchiApplication application = ArchiApplication.get(context);
   // ...
}

why not simply:
MainViewModel.java

private void loadGithubRepos(String username) {
   // ...
   ArchiApplication application = (ArchiApplication) context.getApplicationContext();
   // ...
}

(I tried it and the app runs just fine)
Is it to prevent memory leak or sth? I can't seem to get my head around it
Sorry for the noob question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant