title: Multiple clickspans in a textview
body: <p>I have a function to build clickable tags for a textview. It goes as follows:</p>
  
  <pre><code>    private CharSequence tagsBuilder(String text, String token) {
      SpannableStringBuilder builtTags = new SpannableStringBuilder();
      int start = 0, end = 0;
  
      for(int i = 0; i &lt; 5; i++) {
          start = 0;
          end = text.indexOf(token, 0);
  
          try {
              if(start &lt; end) {
                  SpannableStringBuilder ssb = new SpannableStringBuilder(text.substring(start, end));
                  ssb.setSpan(new ClickableSpan() {
                      @Override
                      public void onClick(View v)
                      {
  
                          Log.i("DEBUGTAG", "Span clicked - " + ((TextView) v).getText());
                      }
                  }, start, end, 0);
  
                  builtTags.append(ssb);
                  builtTags.append(" ");
                  text = text.substring(end + 1);
              }
          } catch (IndexOutOfBoundsException e) {
              break;
          }
      }
  
      return builtTags;
  }
  </code></pre>
  
  <p>I can see the textview with 5 individually clickable tags. But the problem is, the Log that prints for any tag that is clicked is whole text of the textview.</p>
  
  <p>Am I doing something wrong here? How do I get the text of individual tags that were clicked.</p>