I have a Android App that gets its data from a REST-API. The REST-API gives me urls to other subpages of the REST-API. Now, I need to share these urls between different fragments (following MVVM single activity architecture).
I've come up with different solutions:
• Create static variables that save the urls in either the Single Activity or in a static Helperclass
• Save them in SharedPreferences
• Share them via SharedViewModels
Out of these 3 the first one is my favorite since it's not using files like SharedPreferences and not a overkill like SharedViewModels, however, I have the feeling that static url variables might be bad practice. So my question is, which is the best way to solve this issue.
Aucun commentaire:
Enregistrer un commentaire