-1

I use a Script for a Medical Directory for Students and i'm a beginner in android.

I use a Firebase database to store the data for the app. so i wrote html tags like

<b>Anatomy</b>

but the app doesn't format the html tag

private void initView() {
    setContentView(R.layout.activity_word_detail);
    tvWord = findViewById(R.id.textview_word);
    tvWordMeaning = findViewById(R.id.textview_word_meaning);
    tvType = findViewById(R.id.textview_word_type);
    tvSynonym = findViewById(R.id.textview_synonym);
    tvAntonym = findViewById(R.id.textview_antonym);
    tvExample = findViewById(R.id.textview_example);
    voiceIcon = findViewById(R.id.voice_icon_detail);
    favorite=findViewById(R.id.favorite_icon_detail);
    unFavorite=findViewById(R.id.unfavorite_icon_detail);

}
<TextView
                 android:id="@+id/textview_example"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginRight="32dp"
                 android:textColor="@color/blue"
                 android:text="@string/example_text"
                 android:textSize="14sp"
                 android:paddingBottom="10dp"
                 android:autoLink="web"
                 android:linksClickable="true"
                 />

i don't know what to do that the TextView with id textview_example shows the results with html format

Zoe
  • 27,060
  • 21
  • 118
  • 148
Swsche
  • 3
  • 1
  • see here https://stackoverflow.com/questions/2116162/how-to-display-html-in-textview – Vigen May 10 '19 at 20:32
  • Possible duplicate of [How to display HTML in TextView?](https://stackoverflow.com/questions/2116162/how-to-display-html-in-textview) – raxerz May 10 '19 at 20:39
  • i think is not the same because i have two variables tvExample and the textview id textview_example. sorry but i'm a beginner – Swsche May 10 '19 at 21:00

1 Answers1

0

Try this

tvExample.setText(Html.fromHtml("<p> text here</p>"));
Dharmender Manral
  • 1,504
  • 1
  • 6
  • 7