Skip to content

Instantly share code, notes, and snippets.

@alaershov
Created June 4, 2019 17:40
Show Gist options
  • Save alaershov/c42ec8ba159f1b2ded543532591fea75 to your computer and use it in GitHub Desktop.
Save alaershov/c42ec8ba159f1b2ded543532591fea75 to your computer and use it in GitHub Desktop.
Toothpick: bind to instance
public final class RepositoryModule extends Module {
public RepositoryModule(Context context) {
bind(UserRepository.class);
SharedPreferences sharedPreferences = context.getSharedPreferences("app.prefs", MODE_PRIVATE);
bind(SharedPreferences.class).toInstance(sharedPreferences);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment