I have problem to launch phone's dialer when I click on digits inside my custom info window. This infowindow is appeared each time I click on a marker on a map api v2. I would like to show a tel number in the infowindow of marker, and click it to dial screen (launch dialer with my digits inserted).
This is my activity:
public View getInfoContents(Marker marker) {
View v = getLayoutInflater().inflate(R.layout.infowindow_layout, null);
//start phone call
final TextView tvDialer =(TextView) v.findViewById(R.id.dialer);
tvDialer.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
String phoneNo= tvDialer.getText().toString();
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" +phoneNo));
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(callIntent);
}
});
//end phone call
// Returning the view containing InfoWindow contents
return v;
}
Here is my XML:
<TextView
android:id="@+id/dialer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="phone"
android:text="1234567" />
Could you please help me?