title: How to show maps inside tab
body: <p>I am new to android and have no experience of Java either.
  I am making an application that has tabs. One of the tabs, when clicked must show googlemap. I was successful doing that, the problem is when the map is displayed, it does not show the tab so i could not return to other tabs. the purpose of the other tabs is to display the location of that were selected on the mapview. could anyone help me with this? below are my codes</p>
  
  <p><strong>MainActivity.java</strong></p>
  
  <pre><code>package jp.co.gpsloader;
  
      import android.app.Activity;
      import android.app.ActivityGroup;
      import android.content.Context;
      import android.content.Intent;
      import android.database.Cursor;
      import android.database.sqlite.SQLiteDatabase;
      import android.os.Bundle;
      import android.widget.TabHost;
      import android.widget.TabHost.TabSpec;
      //Used Activity group because tabhost was used ActivityGroup
      @SuppressWarnings("deprecation")
      public class MainActivity extends ActivityGroup {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          // Then do Main Activity name
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_android_tab_layout);
          TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
          tabHost.setup();
  
          // Then added an Intent on our new tab
          TabSpec spec2 = tabHost.newTabSpec("Location");
          spec2.setIndicator("Location");
          spec2.setContent(new Intent(this, SampleMapClickListener.class));
  
          TabSpec spec3 = tabHost.newTabSpec("The GPS");
          spec3.setIndicator("The GPS");
          spec3.setContent(new Intent(this, GpsMain.class));
  
  
          Context ctx = this.getApplicationContext();
          Intent i = new Intent(ctx, GpsMain.class);
          spec3.setContent(i);
  
          // Add your new tab in the tabhost here
          tabHost.addTab(spec2);
          tabHost.addTab(spec3);
  
          // This is needed for Activity group
          tabHost.setup(this.getLocalActivityManager());
  
          tabHost.setCurrentTab(0);
      }
  }
  </code></pre>
  
  <p><strong>GPSMain.java</strong></p>
  
  <pre><code>package jp.co.gpsloader;
  
  import android.os.*;
  import android.widget.Toast;
  import android.app.*;
  import android.content.Context;
  import android.content.Intent;
  import android.database.Cursor;      
  import com.google.android.gms.internal.v;
  import com.google.android.gms.maps.*;
  import com.google.android.gms.maps.GoogleMap.*;
  import com.google.android.gms.maps.model.*;
  
  public class GpsMain extends Activity {
  MapFragment mf;
  GoogleMap gm;
  MarkerOptions marker;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      mf = MapFragment.newInstance();
      FragmentManager fm = getFragmentManager();
      FragmentTransaction ft = fm.beginTransaction();
      ft.add(android.R.id.content, mf);
      ft.commit();
  }
  public void onResume() {
      super.onResume();
  
      // created map
      gm = mf.getMap();
      gm.setMapType(GoogleMap.MAP_TYPE_HYBRID);
      gm.setMyLocationEnabled(true);
  
      // set latitude and longitude
      LatLng ltn = new LatLng(40, 135);
  
      // create marker
      marker = new MarkerOptions();
      marker.position(ltn);
  
      // operation can be done, when click happens
      gm.setOnMapClickListener(new SampleMapClickListener());
  }
  
  class SampleMapClickListener implements OnMapClickListener {
  
      @Override
      public void onMapClick(LatLng ltn) {
          marker = new MarkerOptions();
          marker.position(ltn);
          gm = mf.getMap();
          // add marker
          gm.addMarker(marker);
  
      }
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p><strong>activity_android_tab_layout.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;TabHost android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:id="@+id/tabHost"
  xmlns:android="http://schemas.android.com/apk/res/android"
  &gt;
  &lt;TabWidget
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:id="@android:id/tabs"
  /&gt;
   &lt;FrameLayout
   android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:id="@android:id/tabcontent"
   &gt;
   &lt;LinearLayout
   android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:id="@+id/tab1"
  android:orientation="vertical"
  android:paddingTop="60px"
   &gt;
   &lt;TextView  
  android:layout_width="fill_parent" 
  android:layout_height="100px" 
  android:text="This is tab1"
  android:id="@+id/txt1"
  /&gt;    
  
   &lt;/LinearLayout&gt;
  
   &lt;LinearLayout
   android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:id="@+id/tab2"
  android:orientation="vertical"
  android:paddingTop="60px"
   &gt;
   &lt;TextView  
  android:layout_width="fill_parent" 
  android:layout_height="100px" 
  android:text="This is tab 2"
  android:id="@+id/txt2"
  /&gt;
  
   &lt;/LinearLayout&gt;
  
  
   &lt;/FrameLayout&gt;
  
  &lt;/TabHost&gt;
  </code></pre>
  
  <p><strong>map.xml</strong></p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent" &gt;
  
  &lt;com.google.android.gms.maps.MapView
      android:id="@+id/mapview"
      android:layout_width="100dip"
      android:layout_height="100dip"
      android:layout_alignParentTop="true"
      android:layout_alignRight="@+id/textView1"
      android:layout_marginRight="15dp" &gt;
  &lt;/com.google.android.gms.maps.MapView&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>