title: Difficulties implementing Model-View-Presenter in Android
body: <p>Model-View-Presenter (MVP) is a well known design pattern for GUI applications. For Android, implementing the business logic in a plain Java module facilitates testing without requiring an Android emulator.</p>
  <p>However, I am having difficulties implementing the pattern on Android because of special requirements to the GUI of Android applications:</p>
  <ul>
  <li><p>An Activity may be destroyed at any point (incoming call, user presses home button, ...), and when recreated it should be in the exact same state as when it was left. This is unlike most other GUI applications.</p>
  </li>
  <li><p>An Activity can go through many lifecycle states. It may be paused in which case the UI of the Activity should not be modified. If for example some data is being loaded in the background, it cannot be delivered to the View part of MVP (Activity) if it is in a paused state. Again, this is an unusual requirement.</p>
  </li>
  </ul>
  <p>I have read the blog post <a href="http://antonioleiva.com/mvp-android/" rel="noreferrer">MVP for Android</a> and looked at the <a href="https://github.com/antoniolg/androidmvp" rel="noreferrer">example source code</a>. The end goal I am trying to achieve by using the MVP pattern is to be able to translate all business logic to Objective-C using the transpiler <a href="https://github.com/google/j2objc" rel="noreferrer">j2objc</a>, such that the business logic can be reused while implementing the same app on iOS.</p>
  <p>Is there anyone that have implemented the MVP pattern for Android successfully, and in that case, what am I missing?</p>