How to render html tags in Android

In this android programming source code example, we are going to render html tags in Android.

You can copy and adopt this source code example to your android project without reinventing the wheel.

Below is a step by step source code to render html tags in Android.


<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=""

        app:layout_constraintEnd_toEndOf="parent" />


import androidx.core.text.HtmlCompat;

import android.os.Bundle;
import android.widget.TextView;

import com.bluapp.androidview2.R;

public class DeviceFeaturesActivity6 extends AppCompatActivity {
    private TextView renderHtml;
    String htmlText = "<h2>What is Android?</h2>\n" +
            "<p>Android is an open source and Linux-based <b>Operating System</b> for mobile devices such as smartphones and tablet computers. Android was developed by the <i>Open Handset Alliance</i>, led by Google, and other companies.</p>\n" +
            "<p>Android offers a unified approach to application development for mobile devices which means developers need only develop for Android, and their applications should be able to run on different devices powered by Android.</p>\n" +
            "<p>The first beta version of the Android Software Development Kit (SDK) was released by Google in 2007 whereas the first commercial version, Android 1.0, was released in September 2008.</p>";

    protected void onCreate(Bundle savedInstanceState) {
        renderHtml = (TextView) findViewById(;
        renderHtml.setText(HtmlCompat.fromHtml(htmlText, 0));

If you have any question or suggestions kindly use the comment box or you can contact us directly through our contact page below.

Add a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

50% Discounts On Projects

Do you have a custom project with a clear requirements, we are currently giving a 50% discount on all projects.

We will work with you to ensure we deliver what you need.

If you have questions or want to chat with us, you can reach us on Skype (henry.tochi)

Languages and technologies we use - Java, Kotlin, Laravel, Vue, React, Flutter, Swift and more.