title: Android TabActivity with Google Maps and phone Camera
body: <p>I'm newbie, I'm preparing my first Android application and I have a problem with putting features together.</p>
  
  <p>I have application with four tabs (<code>TabActivity</code>), two (1st and 4th) are only static, but in 2nd should be phone front camera (like a mirror) and in 3rd should be Google Maps API v2 with markers. Everything works separated fine, but when I choose 2nd tab with mirror, and then 3rd tab with Google maps there is an error. Maps don't display. Same problem is when I close the application and try it again, but at first I open 3rd tab with Google Maps (works fine) and then tap to 2nd tab with mirror and nothing change, I see still maps (but I can't zoom it etc.).</p>
  
  <p>I thing, I need something, when I tap to another tab, the mirror is killed (maybe maps too), but I can't find how can I do it. Maybe something about <code>surfaceDestroyed()</code>?</p>
  
  <p>Here is MainActivity:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      TabHost tabHost = getTabHost();
  
      //tab1 - static text
      TabSpec tab1spec = tabHost.newTabSpec("tab1");
      tab1spec.setIndicator("One", getResources().getDrawable(R.drawable.pin_empty));
      Intent tab1Intent = new Intent(this, Tab1Activity.class);
      tab1spec.setContent(tab1Intent);
  
      //tab2 - mirror
      TabSpec tab2spec = tabHost.newTabSpec("tab2");
      tab2spec.setIndicator("Mirror", getResources().getDrawable(R.drawable.pin_empty));
      Intent tab2Intent = new Intent(this, CameraActivity.class);
      tab2spec.setContent(tab2Intent);
  
      //tab3 - Google maps
      TabSpec tab3spec = tabHost.newTabSpec("tab3");
      tab3spec.setIndicator("Map", getResources().getDrawable(R.drawable.pin_empty));
      Intent tab3Intent = new Intent(this, GoogleMapsActivity.class);
      tab3spec.setContent(tab3Intent);
  
      //tab4 - static text
      TabSpec tab4spec = tabHost.newTabSpec("tab4");
      tab4spec.setIndicator("Four", getResources().getDrawable(R.drawable.pin_empty));
      Intent tab4Intent = new Intent(this, Tab4Activity.class);
      tab4spec.setContent(tab4Intent);
  
      tabHost.addTab(tab1spec);
      tabHost.addTab(tab2spec);
      tabHost.addTab(tab3spec);
      tabHost.addTab(tab4spec);
  }
  </code></pre>
  
  <p>Here are two screenshots. I clicked to 3rd tab (maps) and then to 2nd tab (mirror), but I still see maps, no my face in the mirror:</p>
  
  <p>1/ <a href="http://krispin.cz/_/so/TabActivity_problem-map.png" rel="nofollow noreferrer">http://krispin.cz/_/so/TabActivity_problem-map.png</a>
  <img src="https://i.stack.imgur.com/hrHrF.png" alt="enter image description here">
  2/ <a href="http://krispin.cz/_/so/TabActivity_problem-mirror.png" rel="nofollow noreferrer">http://krispin.cz/_/so/TabActivity_problem-mirror.png</a>
  <img src="https://i.stack.imgur.com/4IJI5.png" alt="enter image description here"></p>