iammert / AndroidArchitecture

Recommended architecture by Android
888 stars 191 forks source link

hello, How do you pass an activity into a MovieRepository? #17

Open i91h1r opened 6 years ago

i91h1r commented 6 years ago

for example: I need to use activity in MovieRepository ,so how can I inject activity to MovieRepository?

@Inject public MovieRepository(MovieDetailActivity movieDetailActivity,MovieDao movieDao, MovieDBService movieDBService) { this.movieDao = movieDao; this.movieDBService = movieDBService; }

can you write a example in the project ? thinks

basel93natour commented 4 years ago

you are not supposed to pass activity to repository in this case you are breaking the concept of MVVM

chiftenj commented 4 years ago

@hyr0318 you should use ViewModel to interact with repository layer, passing activity into repository violated mvvm principles.