Skip to content

Instantly share code, notes, and snippets.

@parahall
Created May 12, 2017 10:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save parahall/38411f70b18170fce87f1e158bec520c to your computer and use it in GitHub Desktop.
Save parahall/38411f70b18170fce87f1e158bec520c to your computer and use it in GitHub Desktop.
@Module public class AppModule {
private Application application;
public AppModule(Application application) {
this.application = application;
}
@Provides @Singleton Context providesAppContext() {
return application.getApplicationContext();
}
@Provides @Singleton AppDatabase providesDatabase(Context context) {
return Room.inMemoryDatabaseBuilder(context, AppDatabase.class).build();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment