/** * @see com.brantapps.polaris.api.Mappable#addToView(android.support.v4.app.FragmentActivity, int) */ @Override public void addToView(final FragmentActivity activity, final int parentViewId) { if (mapView.getParent() != null) { ((ViewGroup) mapView.getParent()).removeView(mapView); } ((ViewGroup) activity.findViewById(parentViewId)) .addView( mapView, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); mapReadyListener.onMapReady(); }
/** * @param layoutResId the id of the view resource. * @param mapView the mapview on which is hooked the view */ public InfoWindow(int layoutResId, MapView mapView) { mMapView = mapView; mIsVisible = false; ViewGroup parent = (ViewGroup) mapView.getParent(); Context context = mapView.getContext(); LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mView = inflater.inflate(layoutResId, parent, false); }
// You should not need to touch this method @Override public void onDestroyView() { Log.d(LOG_TAG, "onDestroyView"); ((ViewGroup) mapView.getParent()).removeView(mapView); super.onDestroyView(); }