Note that there are some explanatory texts on larger screens.

plurals
  1. POFragmentMap + ActionBar Tab
    text
    copied!<p>I've been trying insert a <code>MapView</code> into an <code>ActionBar</code> <code>Tab</code>, but I wasn't able to solve the problem even googling.</p> <p>Here is the Main Activity:</p> <pre><code>@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.action_bar_tabs); FragmentManager fm = getSupportFragmentManager(); fm.beginTransaction().add(android.R.id.content, GigLoader.GigLoaderListFragment.newInstance()).commit(); getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); ActionBar.Tab tab1 = getSupportActionBar().newTab().setText("Geo").setTabListener(this); ActionBar.Tab tab2 = getSupportActionBar().newTab().setText("Lista").setTabListener(this); getSupportActionBar().addTab(tab1); getSupportActionBar().addTab(tab2); } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { if (tab.getPosition() == 0) { fm.beginTransaction().add(android.R.id.content, GigLoader.GigLoaderListFragment.newInstance()).commit(); } else { fm.beginTransaction().add(android.R.id.content, GeoGigLoader.GeoGigMapFragment.newInstance()).commit(); } } </code></pre> <p>And here the code of the <code>GeoGigLoader</code>:</p> <pre><code>public class GeoGigLoader extends FragmentMapActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public static final class GeoGigMapFragment extends Fragment { static GeoGigMapFragment newInstance() { GeoGigMapFragment map = new GeoGigMapFragment(); return map; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = getActivity().getLayoutInflater().inflate(R.layout.map_gigs, container, false); MapView mapView = (MapView)view.findViewById(R.id.map_view); mapView.setBuiltInZoomControls(true); return view; } } @Override protected boolean isRouteDisplayed() { return false; } } </code></pre> <p><code>FragmentMapActivity</code> is a library from actionbarsherlock.com, and this one extends from a <code>MapActivity</code>, so it should work.</p> <p>The error I get, is the next one:</p> <blockquote> <p><code>FATAL EXCEPTION: main E/AndroidRuntime(954): android.view.InflateException: Binary XML file line #2: Error inflating class com.google.android.maps.MapView E/AndroidRuntime(954): at android.view.LayoutInflater.createView(LayoutInflater.java:513) E/AndroidRuntime(954): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)</code></p> </blockquote> <p>Anybody know what's happening?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload