5

Curiously want to know what is the purpose of Spannable in android. Isn't char array sufficient?

SmileyChris
  • 10,578
  • 4
  • 40
  • 33
DraD
  • 211
  • 1
  • 3
  • 7

1 Answers1

9

A Spannable allows to attach formatting information like bold, italic, ... to sub-sequences ("spans", thus the name) of the characters. It can be used whenever you want to represent "rich text".

The Html class provides an easy way to construct such text, for example:

Html.fromHtml("Text with <b>bold</b> and <em>italic</em>.")
Henry
  • 42,982
  • 7
  • 68
  • 84
  • exactly .. my question was any special case where we should use spannable and nothing else will work – DraD Feb 19 '13 at 08:41