开发者

Linkify the text problem

开发者 https://www.devze.com 2023-04-03 22:42 出处:网络
It is a glossary application.I have kept the data in string-array ..in strings.xml <string-array name=\"title\">

It is a glossary application.I have kept the data in string-array ..in strings.xml

<string-array name="title">
    <item>aaaa</item>
    <item>bbbb</item>
    <item>cccc</item>
    <item>dddd </item>

</string-array>

 <string-array name="definition">
    <item>This is first entry relate to bbbb. .</item>
    <item>This is a book.</item>
    <item>This is  aaaa so link it there.</item>
    <item>This is related to cccc</item>

</string-array>

In activity1, I have list of all data displaying in a list view. On click of that it will go to activity 2 containing word and definition. In an activity2 I have 2 textviews.One for displaying title and second one for definition. In the definition,if any title exists it should be hyperlinked and onclick of that it should show the title and definition.

I followed the link below 开发者_高级运维to refer.. Android: Launch activity from clickable text

but in above question it is just a string..how to do for string array?

Thank you..


This is exactly what the Android Developer documentation is for Linkify. Please read the documentation!!!

public static final void addLinks (TextView text, Pattern pattern, String scheme)


Pass the title as parameter in the URL if you using PHP or ASP. Or make your one view with a webview passing the title to the other activity.

0

精彩评论

暂无评论...
验证码 换一张
取 消