Zaask
Zaask

Reputation: 655

Link Text with phone's dialer (Android)

So I have this TextView field and it has a number in it

<TextView android:phoneNumber="true" android:textSize="14sp" android:textColor="#283486" android:layout_width="300dip" android:id="@+id/Contact" android:gravity="bottom" android:layout_height="wrap_content" android:text="@string/phoneNumber"></TextView>

I want it so that when they touch this number it takes them to the number dialer on their phone so that they can call that number.

How would I go about that

Upvotes: 1

Views: 1761

Answers (1)

Femi
Femi

Reputation: 64700

Try to add the android:autoLink attribute:

    <TextView android:autoLink="phone"   
     android:phoneNumber="true"  
     android:textSize="14sp"   
     android:textColor="#283486"   
     android:layout_width="300dp"  
     android:id="@+id/Contact"   
     android:gravity="bottom"   
     android:layout_height="wrap_content"   
     android:text="@string/phoneNumber">  
   </TextView>

Upvotes: 3

Related Questions