user3196789
user3196789

Reputation: 15

Opening an URL when clicking a Marker (Google Maps Android)

When you place a Marker on a Google Map Fragment you can touch (click) this to get a small "Pop-Up" with aditional information. Can I open a URL by clicking on this Pop-up once more? If in a browser or whatever wouldn't matter.

Is it possible and ìf, how?

Upvotes: 0

Views: 1083

Answers (2)

Sindhuja Reddy
Sindhuja Reddy

Reputation: 1

public void onInfoWindowClick(Marker arg0){
    String url = "https://www.google.com";
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse(url));
    startActivity(i);
}      

Upvotes: 0

Shadow
Shadow

Reputation: 6899

When you click marker, you will pass title and snippet in your popup window If you want to pass when you click popup, use onInfoWindow() to open URL...

Googlemap gm;
gm.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
    @Override
    public void onInfoWindowClick(Marker marker) {
        //Do your stuff here by passing url.
    }
});

Upvotes: 1

Related Questions