title: Android MVP. Who cares about launching and getting data from dialogs and external apps?
body: <p>I like MVP concept, it helps me a lot to organize a code, but every time when i need to <strong>get a result from external app, from dialog, or request permission</strong>, I confront the same question - <strong>which component of architecture should care about this?</strong></p>
  
  <p>For example, we need to implement following behaviour:</p>
  
  <ul>
  <li>click on the button starts Google voice recognition intent</li>
  <li>if we have more than one result - show a list dialog and let user to
  choose right variant</li>
  <li>do smth with it</li>
  </ul>
  
  <p>So, we can do smth like this (also decide that Fragment implements View, contains link to Presenter and sends UI event to it):</p>
  
  <pre><code>interface View {
  
      void showRecognizer();//2
  
      void showChooseDialog(List&lt;String&gt; items);//4
  
  }
  
  interface Presenter {
  
      void onButtonClick();//1
  
      void onRecognizerResult(List&lt;String&gt; results);//3
  
      void onResultChosen(String result);//5
  
  }
  </code></pre>
  
  <p>Ok, it will work, but we have some problems:</p>
  
  <ul>
  <li>Algorithm is <strong>not fully encapsulated</strong> - if you want to change it, you would have to change view and presenter interfaces</li>
  <li>If you have a few algorithms like this on one screen, your V &amp; P interfaces will be huge and <strong>difficult to read</strong> and understand</li>
  <li><strong>View becames</strong> a little bit <strong>clever</strong> than it should be (both V &amp; P knows about 1, 2, 3, 4, 5 sequence), <strong>Presenter knows</strong> about <strong>details</strong> (dialog is an implementation detail, but it asks View to launch it)</li>
  <li>Algorithm is <strong>not reusable</strong>! How to use it on other screen?</li>
  </ul>
  
  <p>So, I want to know your opinion about this, how it can be done better (or maybe you think this is ok)?</p>
  
  <p><strong>And generally speaking: starting dialogs and activities, requesting permissions, handling results, whose duty it is from the point of MVP and clean architecture?</strong></p>
  
  <p>Any thoughts or suggestions are encouraged. Please help me to clarify this, thanks.</p>