0
protected String getEntryContent(String entryContent) {
    Log.d(getClass().getName(), "getEntryContent()");
    String mWebViewContent;
     mWebView.loadDataWithBaseURL(baseUrl,
            entryContent, mimeType,
            encoding, null);

        mWebViewContent =Html.fromHtml(entryContent).toString();
        return mWebViewContent;
    }

Output:

    h2 {font-size:1.2em;font-weight:normal;} a {color:#6688cc;} ol {padding-             left:1.5em;} blockquote {margin-left:0em;} .interProject, .noprint {display:none;} li, blockquote {margin-top:0.5em;margin-bottom:0.5em;}


quarterly (not comparable) Occurring once every quarter year (three months).

quarterly rent payments

This gives me starting line as a CSS. How can i remove that?

0

2 Answers 2

2

You probably passed the inline CSS in your string. From the javadoc of HTML.fromHtml it nowhere states that it can handle inline css, therefore it propably handles it like normal text

Returns displayable styled text from the provided HTML string. Any tags in the HTML will use the specified ImageGetter to request a representation of the image (use null if you don't want this) and the specified TagHandler to handle unknown tags (specify null if you don't want this).

You have to remove the css manually yourself. See this answer on how to do that: Removing css information from HTML in java

Sign up to request clarification or add additional context in comments.

Comments

0

You can use this:

CharSequence mSequence = Html.fromHtml("<b>Hello</b> Android");
    textView.setText(mSequence);

You can also convert it into String as:

String mString = mSequence.toString();

2 Comments

It's not working. I want only quarterly (not comparable) Occurring once every quarter year (three months). quarterly rent payments String entryContent is my parsedText from JSON to String
It's not working. I want only quarterly (not comparable) Occurring once every quarter year (three months). quarterly rent payments. \n String entryContent is my parsedText HttpResponse to JSON and JSON to String.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.