0

I am working with an Android Application, i have a string which has different values getting from an html parsing using jsoup, i have some player names in this string now i want to make all player names clickable individually, i need to show some stats of each player, how i make them clickable individually as all the players are in one string,

String result;
Element nodeBlogStats = document.getElementById("forwards");
    for (org.jsoup.nodes.Element row : nodeBlogStats.select("tr")) {
        for (org.jsoup.nodes.Element column : row.select("td")) {
            for (int i = 0; i <= 5; i++) {
                for (org.jsoup.nodes.Element n : column.select("td#LW" + i)) {

                    result += column.text();
                }
            }
        }
        result = "<u>" + result + "</u>";
        result += "<br><br>";
    }

this is my code for getting player names from specific url, i have player names in my "result" string, i want to make each player name clickable and then how i use some function in that clickable function. Thanks in Advance

2 Answers2

0

You best solution would probably be to make them into some sort of ListView like in this example. Then you want an OnItemClickListener to make them clickable.

listview.setOnItemClickListener(new onItemClickListener(){

@Override
protected void onListItemClick(){

//Do stuff
}
});
MSpeed
  • 8,153
  • 7
  • 49
  • 61
0

As long as you have all these in a single string, its not possible. Atleast not possible to make them all clickable individually. So you should use any other way of doing this. As like said by billynomates, use a listview or a simple text view should do. Refer to this :how-to-click-or-tap-on-a-textview-text

Community
  • 1
  • 1
Tapeshvar
  • 338
  • 1
  • 13