title: Android Amplify App: How to login with Hosted UI without leaking Activity
body: <p>I am following the Android MVVM Repository pattern for a 1-activity-many-fragments app.
  I am also using AWS Amplify to login the user with the Hosted Web UI.
  The Amplify <code>signInWithWebUI()</code> API takes an <code>Activity</code> as an argument.
  Their docs do not take MVVM into consideration, and suggest calling the API from <code>MainActivity</code>.</p>
  <p>As of now, the user will press a button to login, and the <code>Activity</code> is passed (never stored) to the <code>ViewModel</code>, then passed to the <code>Repository</code>, then passed to a service called <code>CognitoService</code> where the API is finally called. To me, this violates MVVM because I could be leaking <code>Activity</code>.</p>
  <p><em><strong>Question</strong></em></p>
  <p>Does this actually violate MVVM? I never store <code>Activity</code>, just pipeline it to the service.</p>
  <p>Is there a better, accepted way to fetch a reference to the <code>Activity</code> from the Repository and/or Model layers?</p>
  <p>I have already devised a method to get application <code>Context</code> from the Repository; can I get an <code>Activity</code> reference from that?</p>
  <p>Thanks, I will post code if need be.</p>