Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@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