TextView HTML rendering


Last Updated:

  1. sreymj

    sreymj Well-Known Member This Topic's Starter

    Joined:
    Sep 26, 2010
    Messages:
    166
    Likes Received:
    18
    How do you maintain HTML formatting with Html.fromHtml? The format is lost when displaying in a TextView.
     

    Advertisement
  2. vinay1497

    vinay1497 Member

    Joined:
    Jun 8, 2010
    Messages:
    6
    Likes Received:
    2
    Hello

    you can use HTML.fromHtml("html tags content");

    to display it in text view


    Best of luck.

    Thanks
    Vinay Guntaka
     
  3. sreymj

    sreymj Well-Known Member This Topic's Starter

    Joined:
    Sep 26, 2010
    Messages:
    166
    Likes Received:
    18
    That is what I am currently using. But, the HTML formatting is lost when displayed in the TextView.
     
  4. sreymj

    sreymj Well-Known Member This Topic's Starter

    Joined:
    Sep 26, 2010
    Messages:
    166
    Likes Received:
    18
    As it turns out, I was approaching this all wrong. The correct solution is to use the WebView.

    WebView webview;
    webview = (WebView) findViewById(R.id.WebView01);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.loadUrl("http://someurl.com");

    Hello, WebView | Android Developers
     

Share This Page

Loading...