1

I was creating list using the array.xml and populating it into listView The problem is I need to add a hyperLinked text within the arrayItem decsription so than when I populate it into listView it should link to my website!!!

    <string-array name="about_us">
    <item><b>What is it all about ?</b>\n\this is a mobile application </item>
    <item><b>Where all goods go ?</b>Currently the  goods can get delivered only in India.</item>
    <item><b>How will I Know more?</b>Click [HERE] to go to our website</item>
    </string-array>

is there any way for doing it straight?

P-RAD
  • 1,293
  • 2
  • 15
  • 36

1 Answers1

0
Try this way,hope this will help you to solve your problem.

<string name="link">1.Click &lt;a href="http://www.google.com"> here &lt;/a> to goto wesite.</string>

textView.setMovementMethod (LinkMovementMethod.getInstance());
textView.setText(Html.fromHtml(getString(R.string.link)));
Haresh Chhelana
  • 24,720
  • 5
  • 57
  • 67
  • I'm not quite getting you! if its with a text box and string I can try this , but how I can do it in an array which contains a lot more text in it ? (text *LINK* more text kind of format) – P-RAD Jun 19 '14 at 12:48
  • can you post some string array with content ? – Haresh Chhelana Jun 19 '14 at 12:53
  • I've updated the questoin .. the main problem is I'm using expandable ListView (customized) for showing the contents ..using an adapter how can I get this ont word linked to web??? – P-RAD Jun 19 '14 at 13:03
  • try to set your link as my ans href="yourweblink". – Haresh Chhelana Jun 19 '14 at 13:09
  • I've managd to get hyperlinnk by adding anchor tags but click is not working :( – P-RAD Jun 19 '14 at 13:09
  • You were right !! with a little modification I got t right ! wrap my LINK within and added this code in java textView.setMovementMethod (LinkMovementMethod.getInstance()); :) thanks a lot Haresh Sorry for wasting this much time!! – P-RAD Jun 19 '14 at 13:46