I am using MVVM architecture for my PhotoEditorActivity, the activity plays the View role. When user clicks "Pick Image" button, I want to start gallery to pick an image and get back its uri to update an ImageView. I am confused in where to call startActivityForResult().
- Call
startActivityForResult()from View: By this way, the activity processes everything, ViewModel and Model become redundant. - Call
startActivityForResult()from ViewModel and View observes Uri from the ViewModel: I can passContextto ViewModel to start activity, but I can not receive uri because ViewModel does not haveonActivityResult(). - Call
startActivityForResult()from Model: View pass aContextto ViewModel, ViewModel continue passing theContextto Model. Using this way, I face the same issue with the second way.
Could you please help me how to properly apply MVVM for this business. What should each component contain? Thank you for your attention.