Skip to content

Instantly share code, notes, and snippets.

@doneill
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save doneill/6097a5d161373f3c3777 to your computer and use it in GitHub Desktop.

Select an option

Save doneill/6097a5d161373f3c3777 to your computer and use it in GitHub Desktop.
Show/Hide a Callout
/**
* Shows a mini callout on the map.
*
* @param location
* the location of the callout
* @param message
* the content of the callout
* @param yOffsetDips
* the y offset of the callout in dips
*/
private void showCallout(Point location, String message, int yOffsetDips) {
View view = mInflater.inflate(R.layout.simple_callout_layout, null);
TextView textView = (TextView) view
.findViewById(R.id.simple_callout_textview);
textView.setText(message);
int yOffset = UiUtils.dipsToPixels(yOffsetDips);
Callout callout = mMapView.getCallout();
callout.setStyle(mCalloutStyle);
callout.setMaxWidth(mMaxCalloutWidth);
callout.setMaxHeight(mMaxCalloutHeight);
callout.setOffset(0, yOffset);
callout.animatedShow(location, view);
}
/**
* Hides the callout.
*/
private void hideCallout() {
Callout callout = mMapView.getCallout();
callout.hide();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment