Doing an Application whcoh displays Markers on a Google Maps Fragment and opens a link in a browser on click, but i have a single marker where i dont want this to happen.
GoogleMap mMap;
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.fragment1)).getMap();
mMap.addMarker(new MarkerOptions()
.position(new LatLng(lat3, lng3))
.snippet(bud1)
.title(name1));
mMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
Uri uriUrl = Uri.parse(pcurl1);
Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
startActivity(launchBrowser);
}
});
Now i want to implement a if (.... != "Your Position")
in the onInfoWindowClick()
but I have no Idea how to check the Marker for this content inside the marker.
Edit: New Problem occured which is "Cannot refer to a non-final variable pcurl1 inside an inner class defined in a different method" and if I set it final it destroys it's funktion becasue it is set inside a loop.
addMarker
method returns a Marker
object. For your location marker, save if as a field eg myLocationMarker
and in the callback do
if (!marker.equals(myLocationMarker)) {
// ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.