5

I have given email link to TextView in xml, but as I am clicking on the TextView its showing unsupported action error, How can I put the active link on email in textview?

Here is my code of string.xml file:

     <resources>
           <string name="emailLink"><a href="mailto:info@knowledgewoods.in">info@knowledgewoods.in</a></string>
     <resources>

And mylayout.xml

      <TextView 
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:textSize="15dp"
         android:textColor="@color/text_color"
         android:layout_marginTop="10dp"
         android:id="@+id/text_email"
         android:autoLink="email"
         android:text="@string/emailLink"/>

I am running my app in android 2.2 and later versions.

Please help me... Thanks

Lalit Sharma
  • 1,142
  • 1
  • 15
  • 32

2 Answers2

14

This is likely to occur when you haven't added a primary account to your mobile. You have to configure your google account with your device. Go to the gmail app in your device and sign in using your gmail account. I had the same problem and after doing this the problem was solved.

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
  • 1
    Is there a way to handle this error programmatically and throw a toast to the user "please setUp your email account" instead of showing him the Unsupported Action error ? – sakis kaliakoudas May 04 '15 at 12:19
  • 1
    @sakiskaliakoudas This is probably what you want to do: http://stackoverflow.com/a/2879403/15139 – rpattabi May 26 '15 at 02:29
  • @rpattabi, I tried this and found that it actually still returns a single result: `com.android.fallback.FallbackActivity`. – Sam Jun 25 '15 at 12:54
2

From my testing, this is a problem that happens when the intent's URI (from setData()) doesn't match anything and you're running on one of the official Android emulators. This doesn't seem to happen on real devices, so it shouldn't be a real-world problem.

Sam
  • 40,644
  • 36
  • 176
  • 219