Search code examples
androidhtmlhref

How to embed html link in a String Android?


Hi I know how to embed a html in a string in xml.

<string name="our_policy">Our app 
    <a href="www.google.com">Policy</a> and 
    <a href="www.google.com">Terms</a>
</string>

But I have to add some more things into this during run time.How to embed html link in a string during run time and sent it via Intent to gmail.Any help will be appreciated and thanks in advance.


Solution

  • you can use

    intent.putExtra(Intent.EXTRA_TEXT,Html.fromHtml("<a href=http://www.google.com >Google</a>")); 
    

    It is the better way.