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

  • Home
  • SEARCH
  • 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 6220279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:55:49+00:00 2026-05-24T07:55:49+00:00

In arrayAdptor we use following code: final LayoutInflater inflater = activity.getLayoutInflater(); row = (LinearLayoutCustom)

  • 0

In arrayAdptor we use following code:

 final LayoutInflater inflater = activity.getLayoutInflater();
    row = (LinearLayoutCustom) inflater.inflate(R.layout.row, null);
    final TextView label = (TextView) row.findViewById(R.id.title);
    label.setText(position + "" + items[position]); 
    return row;

Now suppose some value are null (for example at position 2 , items[2] = null ) so i dont want to show it in row. i want to hide it. if i use

               row.setVisibility(View.GONE) 

it leaves a blank space at this row which i dont want. so what should i do?

  • 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-24T07:55:50+00:00Added an answer on May 24, 2026 at 7:55 am

    You’ll need to have the adapter return the total number of non-null items with getCount and then keep a mapping of position to your internal data structure.

    For example.
    You have a list

    1 - John
    2 - null
    3 - Bill
    4 - Susan
    5 - null
    

    When getCount is called it returns 3.

    Then when getView is called on position 1 you return the item at list[1].
    getView on position 2 returns list[3] (as it’s the 2nd non-null),
    and so forth.

    This is the only way I’ve found to do this.

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

Sidebar

Related Questions

I'm having problems implementing an asynchronous image loader to the following code. I read
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
Please help with this error .... In the following code the get info function
I'm trying to display separate items in a list row. So i use 4
I am generating a listview as follows: setListAdapter(new ArrayAdapter<String>(this, R.layout.row, fileListS)); in which row
I try to set text of ListView in center of layout. I use LinearLayout
I use the below code to create listview without listactivity.I need to know how
I'm trying to load my ListView from the following array static final String[][] Bookings
I'm trying to use the following to create a Spinner . But I get
I use an ArrayAdapter to show items in a ListView. Every row in this

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.