In actual development, the LayoutInflater class is very useful. Its function is similar to findViewById (). The difference is that LayoutInflater is used to find and instantiate xml layout files in layout! FindViewById () is used to find the widget controls (such as buttons and TextView) in a specific xml file ). In many cases, you can use inflate to load an interface that is not loaded or needs to be dynamically loaded. for example, in the getView of BaseAdapter, the widget in the view is obtained in the Custom Dialog. Below is a simple BaseAdapter: first declare LayoutInflater [java] private LayoutInflater inflater = null; use [java] inflater = LayoutInflater in the getView () method. from (context); View v = inflater. inflate (R. layout. listview_item, null); complete code: [java] public class PullXmlAdapter extends BaseAdapter {private List <Book> list = null; private Context context = null; private LayoutInflater inflater = null; public PullXmlAdapter (Context context, List <Book> list) {// TODO Auto-generated constructor stub this. context = context; this. list = list ;}@ Override public int getCount () {// TODO Auto-generated method stub return list. size () ;}@ Override public Object getItem (int arg0) {// TODO Auto-generated method stub return arg0 ;}@ Override public long getItemId (int arg0) {// TODO Auto-generated method stub return arg0;} @ Override public View getView (int arg0, View arg1, ViewGroup arg2) {// TODO Auto-generated method stub inflater = LayoutInflater. from (context); View v = inflater. inflate (R. layout. listview_item, null); TextView TV = (TextView) v. findViewById (R. id. lisview_item_ TV); TV. setText (list. get (arg0 ). getName (); return v ;}}