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

What does LayoutInflater in Android do?

Câu trả lời

The LayoutInflater class in Android is used to instantiate the contents of layout XML files into their corresponding View objects[1][2][3]. It takes an XML file as input and builds the View objects from it[2].

In other words, LayoutInflater is responsible for reading the XML file that describes a layout (or GUI element) and creating the actual objects that correspond to it, making the object visible within an Android app[2].

Some key points about LayoutInflater:

  • It is never used directly. Instead, you retrieve a LayoutInflater instance using Activity.getLayoutInflater() or Context.getSystemService()[1][3]
  • For performance reasons, view inflation relies heavily on pre-processing of XML files done at build time. It only works with an XmlPullParser returned from a compiled resource (R.something file), not a plain XML file at runtime[1][5]
  • It is not thread-safe and a given instance should only be acce...
middle

middle

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

middle

What is the difference between onCreate() and onCreateView() lifecycle methods in Fragment ?

junior

Explain activity lifecycle

junior

What is an AsyncTask ?

Bình luận

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

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