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 communicate between two Fragments?

middle

What are dex files are used for?

senior

What is a ThreadPool ? And is it more effective than using several separate Threads ?

Bình luận

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

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