title: Passing data between Activity and ViewModel
body: <p>I'm learning the new Architecture Components for Android programming and I'm having a tough time understanding what the responsibilities for an activity are. I get that they are only supposed to handle UI, which makes sense, but to what extent? Let's say I have an activity where, initially, there's an EditText where the user can enter a String. There's a button below this that adds another EditText for the user to enter another String. How should this data be handled behind the scenes? The two solutions I've come up with are the following:</p>
  
  <p>1) Handle the data in the ViewModel. </p>
  
  <p>User clicks the button -> Activity tells ViewModel -> ViewModel maintains list of EditTexts -> When user is done, Activity tells ViewModel -> ViewModel processes data</p>
  
  <p>The issue I see with this approach is that now there are UI elements in the ViewModel and I would have to handle a state of sorts (The user adds some EditTexts but then cancels the whole operation and the ViewModel would have to clear it's list) </p>
  
  <p>2) Handle the data in the Activity.</p>
  
  <p>User clicks the button -> Activity maintains list of EditTexts -> When user is done, Activity sends list of Strings to ViewModel -> ViewModel processes data</p>
  
  <p>The issue I see with this approach is that now there's logic in the View that would have to be replaced if this View was ever replaced, it's not as "dumb" as it should be.</p>
  
  <p>what's the preferred way of handling this situation?</p>