0

我正在使用 FragmentTabs 开发一个 android Tab 应用程序,一个 Child Fragment 类使用 Google Maps V2,

        map = ((SupportMapFragment) getActivity().getSupportFragmentManager()
                .findFragmentById(R.id.map)).getMap();

单击地图标记后,我需要移动到另一个子片段类,

        map.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {

            @Override
            public void onInfoWindowClick(Marker marker) {

                FragmentTransaction transaction = getChildFragmentManager().beginTransaction();                 
                transaction.addToBackStack(null);
                transaction.replace(R.id.container_framelayout, new FragmentClass());
                transaction.commit();
                getChildFragmentManager().executePendingTransactions();
            }
        });

但是当我点击标记它冻结我的应用程序时,我也找不到任何例外..

4

1 回答 1

1
        map.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {

            @Override
            public void onInfoWindowClick(Marker marker) {
                FragmentManager fm = getFragmentManager();
                FragmentTransaction ft = fm.beginTransaction();                          
                YourActivity activity = new YourActivity();

                ft.addToBackStack(null);
                ft.replace(R.id.container_framelayout, activity);
                ft.commit();
            }
        });
于 2014-02-11T10:15:40.280 回答