Android Map (v2) Marker Infowindowclicklistener Freezes (then Crashes) When Start Child Tab Activity
googleMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() { public void onInfoWindowClick(Marker marker) { Intent rest_list = new Intent(getParen
Solution 1:
You need to follow these steps to perform custom info window click :
--> implement "GoogleMap.OnInfoWindowClickListener" and "GoogleMap.InfoWindowAdapter"
--> Inflate custom info window :
@Overridepublic View getInfoContents(Marker marker) {
// Inflate the layouts for the info window, title and snippet.ViewinfoWindow= getActivity().getLayoutInflater().inflate(R.layout.custom_info_contents, null);
TextViewtxtStoreName= ((TextView) infoWindow.findViewById(R.id.txtStoreName));
txtStoreName.setText(marker.getTitle());
TextViewtxtStoreAddress= ((TextView) infoWindow.findViewById(R.id.txtStoreAddress));
txtStoreAddress.setText(marker.getSnippet());
return infoWindow;
}
--> Set Listener : // InfoWindowClick
mGoogleMap.setOnInfoWindowClickListener(this);
@OverridepublicvoidonInfoWindowClick(final Marker marker) {
// TODO Here perform action on balloon view click
mRecyclerStore.post(newRunnable() {
@Overridepublicvoidrun() {
StoreModelmodel= (StoreModel) marker.getTag();
booleanisAddedToBackStack=true;
StoreDetailsAndProductListFragmentstoreDetailsAndProductListFragment=newStoreDetailsAndProductListFragment();
Bundlebundle=newBundle();
bundle.putParcelable(ExtrasUtil.STORE, model);
storeDetailsAndProductListFragment.setArguments(bundle);
showOtherFragment(storeDetailsAndProductListFragment, getActivity().getFragmentManager(), isAddedToBackStack);
}
});
}
Post a Comment for "Android Map (v2) Marker Infowindowclicklistener Freezes (then Crashes) When Start Child Tab Activity"