I have a problem I've been trying insert a MapView into a ActionBar
Tab, but I wasn't able to solve the problem even googling...

Here is the Main Activity:

@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();
    }

}

And here the code of the GeoGigLoader:

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;
}
}

FragmentMapActivity is a library from actionbarsherlock.com, and this
one extends from a MapActivity, so it should work...

The error I get, is the next one:

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)

Anybody knows what's happening? Thx!!!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to