我正在使用FragmentTabs开发一个Android Tab应用程序,一个Child Fragment类使用Google Maps V2,
map = ((SupportMapFragment) getActivity().getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
一旦我点击了地图标记,我就需要移动到另一个Child Fragment Class,
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();
}
});
但是当我点击标记时它会冻结我的应用程序,我找不到任何例外......
答案 0 :(得分: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();
}
});