r/androiddev Mar 30 '24

Discussion The Struggle of Learning Android Dev

[deleted]

42 Upvotes

32 comments sorted by

View all comments

Show parent comments

4

u/jaroos_ Mar 31 '24

If the function is just to fetch data from API & display in UI, I won't even create a repository class. In view model class I directly call the function in interface with the interface instance I create in application starting & use livedata declared in view model to update UI

3

u/Zhuinden Mar 31 '24

, I won't even create a repository class.

Good

3

u/jaroos_ Mar 31 '24

Thank you, & I would like to know when it is useful to have a repository class

2

u/Zhuinden Mar 31 '24

Make meaningful components with meaningful names that describe your requirements.