I am currently implementing a map in my project. The map shows certain places around the user with markers.
The markers should provide (among other things) a link to the website of the place, which opens, when clicked, the website.
Apparently, URL formed Strings are not automatically transformed into a link. I tried to solve this by using a custom InfoWindow, but the OnClickListener does not trigger.
Here is the code for the constructor of the InfoWindowAdapter:
MyInfoWindowAdapter(final Context context) {
this.context = context;
v = LayoutInflater.from(context).inflate(R.layout.info_window,
null);
final TextView tvWebsite = (TextView) v.findViewById(R.id.tvMapWebsite);
tvWebsite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(tvWebsite.getText().toString()));
context.startActivity(browserIntent);
Log.d("MAP CLICK", "Clicked ");
}
});