Android Map(V2)标记InfoWIndowClickListener在启动子选项卡活动时冻结(然后崩溃)
当我点击“信息”窗口时,“信息”窗口将冻结,不会导航到另一个选项卡子活动。在冻结和崩溃时,它不会产生任何日志信息 获得解决方案: 我自己找到了解决办法。尝试在InfoWindow上执行异步任务,然后单击 将所有代码(在信息窗口下运行)放入 后期执行。它很有魅力Android Map(V2)标记InfoWIndowClickListener在启动子选项卡活动时冻结(然后崩溃),android,maps,Android,Maps,当我点击“信息”窗口时,“信息”窗口将冻结,不会导航到另一个选项卡子活动。在冻结和崩溃时,它不会产生任何日志信息 获得解决方案: 我自己找到了解决办法。尝试在InfoWindow上执行异步任务,然后单击 将所有代码(在信息窗口下运行)放入 后期执行。它很有魅力 您需要按照以下步骤执行自定义信息窗口单击: -->实现“GoogleMap.OnInfoWindowClickListener”和“GoogleMap.InfoWindowAdapter” -->充气自定义信息窗口: googleMap.
您需要按照以下步骤执行自定义信息窗口单击: -->实现“GoogleMap.OnInfoWindowClickListener”和“GoogleMap.InfoWindowAdapter” -->充气自定义信息窗口:
googleMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
public void onInfoWindowClick(Marker marker) {
Intent rest_list = new Intent(getParent(), RestFullDetail.class);
TabGroupActivity parentActivity = (TabGroupActivity)getParent();
parentActivity.startChildActivity("mapRestDetail", rest_list);
}
});
-->设置侦听器:
//信息窗口单击
@Override
public View getInfoContents(Marker marker) {
// Inflate the layouts for the info window, title and snippet.
View infoWindow = getActivity().getLayoutInflater().inflate(R.layout.custom_info_contents, null);
TextView txtStoreName = ((TextView) infoWindow.findViewById(R.id.txtStoreName));
txtStoreName.setText(marker.getTitle());
TextView txtStoreAddress = ((TextView) infoWindow.findViewById(R.id.txtStoreAddress));
txtStoreAddress.setText(marker.getSnippet());
return infoWindow;
}
mGoogleMap.setOnInfoWindowClickListener(this);
@Override
public void onInfoWindowClick(final Marker marker) {
// TODO Here perform action on balloon view click
mRecyclerStore.post(new Runnable() {
@Override
public void run() {
StoreModel model = (StoreModel) marker.getTag();
boolean isAddedToBackStack = true;
StoreDetailsAndProductListFragment storeDetailsAndProductListFragment = new StoreDetailsAndProductListFragment();
Bundle bundle = new Bundle();
bundle.putParcelable(ExtrasUtil.STORE, model);
storeDetailsAndProductListFragment.setArguments(bundle);
showOtherFragment(storeDetailsAndProductListFragment, getActivity().getFragmentManager(), isAddedToBackStack);
}
});
}