Câu hỏi phỏng vấn Android
Câu hỏi

What is a difference between Spannable and String ?

Câu trả lời

The main difference between Spannable and String in Android is that Spannable allows you to apply formatting spans to specific portions of the text, while String is a plain, immutable sequence of characters without any formatting[1][2].

Some key points:

  • String is immutable and cannot be changed once created, while Spannable allows you to add, remove or modify formatting spans after creation[1][3].
  • Spannable is a subinterface of Spanned, which represents a CharSequence with attached formatting spans[1][3].
  • SpannableString is a concrete implementation of Spannable that stores the text and spans in memory[1][3].
  • When you call setText() on a TextView with a Spannable, it creates a copy of the Spannable as a SpannedString which has immutable text and spans[2].
  • To update the text o...
entry

entry

Gợi ý câu hỏi phỏng vấn

middle

How would you support different screen sizes?

middle

Android Log.v() , Log.d() , Log.i() , Log.w() , Log.e() . When to use each one?

junior

What is View Group? How are they different from Views?

Bình luận

Chưa có bình luận nào

Chưa có bình luận nào