Friday, 15 March 2013

LongPress on ListView with hyperlink on Android -



LongPress on ListView with hyperlink on Android -

i'm developing application in android displays listview element fragment. want set hyperlink on contextual menu shows when long press on item of list, i'm founding difficulties doing that.

i'm familiar on how create text hyperlink in android using

textview t1 = (textview) getactivity().findviewbyid(r.id.text1); t1.setmovementmethod(linkmovementmethod.getinstance());

method i'm not able retrieve appropriate hyperlink (that have in strings.xml xml file)

the next xml file in can find text1

<textview android:id="@+id/text1" .. android:text="@string/perm_internet"/> <textview android:id="@+id/text2" .. android:text="@string/perm_contacts"/>

the next strings.xml file

<resources> <string name="perm_internet"><a href="http://first_link">internet</a></string> <string name="perm_contacts"><a href="http://second_link">contacts</a></string> </resources>

i want when long press on item1 on list shows hyperlink first link , when long press on item2 shows second_link.

would appreciate hints on how that, give thanks you.

include next in textview definition in xml file:

<textview ... android:autolink="web"/>

android listview hyperlink long-press

No comments:

Post a Comment