title: onSurfaceCreated() is not called when activity resumes
body: <p>I'm stuck with a <code>SurfaceView</code> issue, and this problem seems to be related with any misunderstanding of how these <code>SurfaceView</code> callbacks work. </p>
  
  <p>Let's try to solve this theorethicaly:</p>
  
  <p>I have an activity <strong>A</strong>, hosting a <code>fragment</code> which is drawing an object in real time, running a <code>thread</code> to acomplish this task (calling the drawing method of my <code>View</code> periodically and drawing it on the <code>SurfaceView</code>).</p>
  
  <p>Then I switch to activity <strong>B</strong>, which hosts another fragment showing some UI.<br>
  Whenever I switch to this activity <strong>B</strong>, I can see the <code>SurfaceView</code> is being destroyed, so the <code>onSurfaceDestroyed()</code> callback is called and I stop my drawing thread there.</p>
  
  <p>Everything pretty fine and obvious by now, but when I go back to activity <strong>A</strong>, the <code>SurfaceView</code> is not being created, so the <code>onSurfaceCreated()</code> is not called, and thus my drawing thread won't start.<br>
  By debugging, I can see my <code>View</code> exists when I come back from <strong>B</strong> to <strong>A</strong>, and it could be drawn if the thread was running, but for my thread to run, I need the <code>SurfaceView</code> to be created again.</p>
  
  <p>So, my <strong>question</strong> (edited):<br>
  Why the <code>SurfaceView</code> isn't being created when I'm back to fragment <strong>A</strong> if fragment is visible?</p>
  
  <p><em>I'm sorry I can't provide any code for this question but it's more theorethycal than any other kind.</em></p>
  
  <p><strong>EDIT: Progress update</strong></p>
  
  <hr>
  
  <p>After doing some more research and testing, I've realized that any fragment's <code>onCreateView()</code>is only called once in it's lifetime, untill it's removed from the fragment manager and no longer managed by the framework. </p>
  
  <p><code>SurfaceView</code> is destroyed when the fragment which is using it becomes no longer visible, before calling it's <code>onDestroyView()</code>, but sadly (and I don't understand why) <strong>it is not recreated when it becomes visible again</strong>, and this is the source of my problem. I need that <code>SurfaceView</code> to be created again when that fragment becomes visible so it can launch my drawing thread as the framework calls <code>onSurfaceCreated()</code>.</p>
  
  <p>The layout I'm trying to draw consists of two views, one is managed by the framework and the other is drawn using the SurfaceView. When I come back to Activity <strong>A</strong> from <strong>B</strong>, I know the fragment is visible because I can see the view managed by the framework drawn appropriately, but no trace of the one managed by the thread which starts when the <code>SurfaceView</code> is created, as this <code>SurfaceView</code> hasn't been created.</p>