title: Android TagHandler exception
body: <p>I'm developing an Android App and I need to display HTLM (also &lt; li> tags) into a textView. To do so I've found this <a href="https://gist.github.com/mcxiaoke/4f047844adaee8d4f41a" rel="noreferrer">TagHandler</a> but it raise a </p>
  
  <blockquote>
    <p>java.lang.RuntimeException: PARAGRAPH span must start at paragraph
    boundary</p>
  </blockquote>
  
  <p>I've tryed to understand why, but I haven't been able to find a solution. I'm quite new to Android so please help me.</p>
  
  <pre><code>public class HtmlTagHandler implements Html.TagHandler {
      private int mListItemCount = 0;
      private Vector&lt;String&gt; mListParents = new Vector&lt;String&gt;();
  
      @Override
      public void handleTag(final boolean opening, final String tag, Editable output, final XMLReader xmlReader) {
  
          if (tag.equals("ul") || tag.equals("ol") || tag.equals("dd")) {
              if (opening) {
                  mListParents.add(tag);
              } else mListParents.remove(tag);
  
              mListItemCount = 0;
          } else if (tag.equals("li") &amp;&amp; !opening) {
              handleListTag(output);
          }
  
  
  
      }
  
  
  
      private void handleListTag(Editable output) {
          if (mListParents.lastElement().equals("ul")) {
              output.append("\n");
              String[] split = output.toString().split("\n");
  
              int lastIndex = split.length - 1;
              int start = output.length() - split[lastIndex].length() - 1;
              output.setSpan(new BulletSpan(15 * mListParents.size()), start, output.length(), 0);
          } else if (mListParents.lastElement().equals("ol")) {
              mListItemCount++;
  
              output.append("\n");
              String[] split = output.toString().split("\n");
  
              int lastIndex = split.length - 1;
              int start = output.length() - split[lastIndex].length() - 1;
              output.insert(start, mListItemCount + ". ");
              output.setSpan(new LeadingMarginSpan.Standard(15 * mListParents.size()), start, output.length(), 0);
          }
      }
  }
  </code></pre>