Search code examples
androidfirebasefirebase-realtime-databasestyles

Firebase styled text


So I used Java using a button that makes selected EditText to bold. At the edittext it shows bold, then I send the data to firebase database, then retrieve it.

The problem is that Firebase doesn't save the style of the text, so it doesn't display the bold at the retrieve text.

Any solutions for that?


Solution

  • Firebase is only save your data, so it's not support save a bold text. Instead, you can save it yourself.

    1. Add another field beside text field in firebase to save style of text, and handle it when you retrieved from firebase

      { "text": "some text", "style": "bold" }

    2. Save data with html format. Like this

      editText.setText(Html.fromHtml("< b>" + myText + "< /b>");