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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:15:39+00:00 2026-06-17T13:15:39+00:00

I have a ListView with a custom adapter. In every row there is an

  • 0

I have a ListView with a custom adapter. In every row there is an ImageView that is visible only under certain constraints. The problem is that if the first row has this ImageView visible, so it is for the last row as well and viceversa.

Here is the getView() code of my adapter.

public View getView(int position, View view, ViewGroup parent) {
    if (view == null) {
        LayoutInflater inflater = (LayoutInflater) mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.row_idea, null);
    }

    Idea idea = mIdeas.get(position);

    if (idea != null) {
        ImageView imgAlarm = (ImageView) view
                .findViewById(R.id.imgAlarm_rowIdea);
        if (idea.getTimeReminder() != null)
            imgAlarm.setVisibility(ImageView.VISIBLE);

        TextView lblTitle = (TextView) view
                .findViewById(R.id.lblTitle_rowIdea);
        lblTitle.setText(idea.getTitle());

        TextView lblDescription = (TextView) view
                .findViewById(R.id.lblDescription_rowIdea);
        lblDescription.setText(idea.getDescription());
    }
    return view;
}

mIdeas is an ArrayList with all the data to display in the ListView.
imgAlarm is the ImageView that I told above.

  • 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-17T13:15:41+00:00Added an answer on June 17, 2026 at 1:15 pm

    Change

    if (idea.getTimeReminder() != null)
                imgAlarm.setVisibility(ImageView.VISIBLE);
    

    to

    if (idea.getTimeReminder() != null)
                imgAlarm.setVisibility(ImageView.VISIBLE);
    else
                imgAlarm.setVisibility(ImageView.GONE);
    

    What’s happening here is that the adapter is “recycling” the views. So in the case you’re seeing in your tests, the last view and the first view are actually the same instance.

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

Sidebar

Related Questions

I have got ListView with a custom Adapter. Every row contains clickable buttons and
I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter
I have a ListView with a custom list adapter (that extends BaseAdapter). My list
I have listview with custom adapter. In each row i have 2 textviews and
I have a ListView powered by a custom adapter that dynamically changes the background
I currently have a ListView with a custom adapter that gets information describing the
I have created a custom listview and adapter by extending BaseAdapter. Every time I
I have a button that should sort a ListView using a custom adapter. The
I have a custom listview adapter which contains two buttons, the problem is it's
I have a ListView that is being populated with a custom adapter. I have

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.