0

I append extra info to a url that I do not want to show to the user in the textView. Here is what I am doing, but the href link is not the one getting used. This code goes to www.google.com, not the link I put in the href tag. My link is not to Google, just showing this as example of functionality. Any ideas?

String agreementText = context.getString(R.string.PhraseAgreement_Part1);
Spanned fullEulaText = Html.fromHtml(agreementText + "\n <a href=‘http://www.google.com?pcode=somePartner’>www.google.com</a>");
Linkify.addLinks((Spannable) fullEulaText, Linkify.WEB_URLS);

My textView has the tv.setMovementMethod(LinkMovementMethod.getInstance());

And my xml has the android:autoLink="web"

UPDATE SOLVED: It turns out it was a combination of items. First, in my xml, I needed to remove:

android:autoLink="web"
android:linksClickable="true"

Then, I also needed to remove:

Linkify.addLinks((Spannable) fullEulaText, Linkify.WEB_URLS);

And for the textView that I am setting the text (Spannable) to:

tv.setText(TermsAndConditionsUtilities.buildAgreementText(this));
tv.setMovementMethod(LinkMovementMethod.getInstance());

Now I get a url displayed to the user that has an anchor tag url that appends extra info onto to send to the server.

taraloca
  • 9,077
  • 9
  • 44
  • 77
  • possible duplicate of [Android: Linkify TextView](http://stackoverflow.com/questions/4746293/android-linkify-textview) – Pankaj Kumar Apr 08 '14 at 13:36
  • @PankajKumar I have searched other answers and I am doing all the required coding. The difference with mine is that I am showing an actual link, but wanting to direct to that link with info appended to the end of it. I don't see this example anywhere else, and no matter what I have tried...nothing has directed to the link with the append. – taraloca Apr 08 '14 at 13:43

0 Answers0