Hey, Have a question: I am using MVVM pattern in ...
# getting-started
k
Hey, Have a question: I am using MVVM pattern in the app & my approach is: After button click, open a new fragment/class, call viewmodel, call APIs from the server (usecase, repo & repo impl part), and the result would we shown to UI (fragment) after observing the data. So is there any way that after button click, call the API and based on the response of the API, show updated UI in the fragments. Does anyone know how to achieve this kind of behaviour in our android application?
a
First response from google “android MVVM example” has a local and remote data source. https://blog.mindorks.com/mvvm-architecture-android-tutorial-for-beginners-step-by-step-guide
k
@Alex Edwards Yeah same approach I am following in my current project but my question is slightly different. For now I am using: Fragment A -> click button-> navigate to Fragment B and do api calls via MVVM But my question is: Is there any way where we can click the Button in Fragment A, call the API (which I am going to call in Fragment B) & after show the data in Fragment B? In the current behaviour I am going from Fragment A to Fragment B and then calling the API but my question is without going to Fragment B, how to call the API in between and then show the data in Fragment B
a
Try one of the #android channels for a better response to android specific questions
k
Sure thank you 👍