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 7791361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:51:46+00:00 2026-06-01T21:51:46+00:00

My questions are: What is exactly the function of the LayoutInflater? Why do all

  • 0

My questions are:

  1. What is exactly the function of the LayoutInflater?
  2. Why do all the articles that I’ve read check if convertview is null or not first? What does it mean when it is null and what does it mean when it isn’t?
  3. What is the parent parameter that this method accepts?
  • 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-06-01T21:51:48+00:00Added an answer on June 1, 2026 at 9:51 pm

    1: The LayoutInflater takes your layout XML-files and creates different View-objects from its contents.

    2: The adapters are built to reuse Views, when a View is scrolled so that is no longer visible, it can be used for one of the new Views appearing. This reused View is the convertView. If this is null it means that there is no recycled View and we have to create a new one, otherwise we should use it to avoid creating a new.

    3: The parent is provided so you can inflate your view into that for proper layout parameters.

    All these together can be used to effectively create the view that will appear in your list (or other view that takes an adapter):

    public View getView(int position, @Nullable View convertView, ViewGroup parent){
        if (convertView == null) {
            //We must create a View:
            convertView = inflater.inflate(R.layout.my_list_item, parent, false);
        }
        //Here we can do changes to the convertView, such as set a text on a TextView 
        //or an image on an ImageView.
        return convertView;
    }
    

    Notice the use of the LayoutInflater, that parent can be used as an argument for it, and how convertView is reused.

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

Sidebar

Related Questions

Questions exactly like this have been asked before, i've read them all and tried
I have come across a website that appears to use Ajax but does not
There are some similar questions but not exactly like mine. Is there a Func
I've seen certain questions knocking around which are similar, but not exactly the same
When, exactly, does the BSD socket send() function return to the caller? In non-blocking
(This does not relate to the basic programming questions I usually ask!) We have
There are numerous questions on SO similiar to this but not exactly as far
I have read through some of the suggested questions but I am not sure
vb.net windows forms question. I've got 3 forms that have exactly the same functions,
There are a lot of questions on exactly opposite on what I want to

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.