Skip to content Skip to sidebar Skip to footer

How To Make A Link Clickable In A Google Map Marker Infowindowadapter

I'm displaying a couple of markers on a Google Map. When I click on a marker it opens a custom InfoWindowAdapter this.map.setInfoWindowAdapter(new CustomInfoWindowAdapter(getLa

Solution 1:

I finally managed to do it like that:

Yes but the problem IS the phone parsing ;)

I managed to do it like that

this.map.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {

@OverridepublicvoidonInfoWindowClick(Marker marker) {
            finalStringdescription= marker.getSnippet();
            if (!TextUtils.isEmpty(description)) {
                finalSpannablespan= Spannable.Factory.getInstance().newSpannable(description);
                if (Linkify.addLinks(span, Linkify.PHONE_NUMBERS)) {
                    final URLSpan[] old = span.getSpans(0, span.length(), URLSpan.class);
                    if (old != null && old.length > 0) {
                         Intentintent=newIntent(Intent.ACTION_DIAL, Uri.parse(old[0].getURL()));
                         startActivity(intent);
                    }
                }
            }
        }
    });

Post a Comment for "How To Make A Link Clickable In A Google Map Marker Infowindowadapter"