I have a text view that contains an email and a phone number. My desired effect is that when the user taps the email, it opens the default emailing application and when the user taps the phone number, the application pulls it up in the dialer. With the code below:
XML:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/careers_guidance"
android:id="@+id/careers_guidance_text"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginTop="5dp"
android:linksClickable="true"
android:textColorLink="#0000EE"
android:autoLink="all"/>
Java:
careersGuidance = view.findViewById(R.id.careers_guidance_text);
careersGuidance.setText(Html.fromHtml("<p>Help with choosing the right course and with thinking about where this might take you in the future.</p>" +
"<p>Tel: <a href=\"tel:01274433043\">01274 433043</a></p>Email: <a href=\"mailto:careers@bradfordcollege.ac.uk\">careers@bradfordcollege.ac.uk</a>"));
When I run my application, only the email is clickable and works the way I want it to work, the phone number isn't clickable or highlighted.
However, I have noticed that if I remove the email address from the setText java code, and run the application. The phone number becomes blue and underlined as if it is clickable, but when I tap it, nothing happens.
How can I get this working?
Also, I have CALL_PHONE permissions granted in my manifest file, and also on my emulator device.