Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 996479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:52:57+00:00 2026-05-16T06:52:57+00:00

What is the use of LayoutInflater in Android?

  • 0

What is the use of LayoutInflater in Android?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:52:57+00:00Added an answer on May 16, 2026 at 6:52 am

    When you use a custom view in a ListView you must define the row layout.
    You create an xml where you place android widgets and then in the adapter’s code you have to do something like this:

    public MyAdapter(Context context, List<MyObject> objects) extends ArrayAdapter {
      super(context, 1, objects);
      /* We get the inflator in the constructor */
      mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }
    
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View view;
      /* We inflate the xml which gives us a view */
      view = mInflater.inflate(R.layout.my_list_custom_row, parent, false);
    
      /* Get the item in the adapter */
      MyObject myObject = getItem(position);
    
      /* Get the widget with id name which is defined in the xml of the row */
      TextView name = (TextView) view.findViewById(R.id.name);
    
      /* Populate the row's xml with info from the item */
      name.setText(myObject.getName());
    
      /* Return the generated view */
      return view;
    }
    

    Read more in the official documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following main.xml for my app. <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent
I'm trying to use the TouchListView made available here: https://github.com/commonsguy/cwac-touchlist . It's an Android
I try to use the Android compatibility library (or now called the support library)
I have the following template in my android app. When I use the android:layout_MarginTop=20dip
I am using android-uitableview And I have this problem: When I use this code:
My boss said I have to use Android Query, and i found this site:
I'm creating a android application with target on 2.2. I still want to use
I am attempting to use the layout tricks #3 described in Android Layout Tricks
I am new to Android development. I would like to use the viewflipper to
Use Case Show a photo uploaded by the user in a square box with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.