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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:59:10+00:00 2026-06-18T11:59:10+00:00

I am trying to parse this JSON response onto a ListView in android where

  • 0

I am trying to parse this JSON response onto a ListView in android where I am trying to modify the listview by showing an image depending upon the gender and adding a button for male records.

The logic is working fine, except for the last two entries.John Wayne & Leonardo Dicaprio are having details button, same is expected for Johnny Depp & Ravi Tambda.Please guide me for the same.

Using this code, I am trying to differentiate them according to the genders

 if(rowData.mgender.equalsIgnoreCase("male"))
                {
                    imageViewStatus.setImageResource(R.drawable.male);
                }
    else{
                    imageViewStatus.setImageResource(R.drawable.female);
                button.setVisibility(View.GONE);

                }

My output

EDIT 1

public View getView(final int position, View convertView, ViewGroup parent){
            ViewHolder holder = null;
            TextView title = null;
            TextView detail = null;
            TextView data=null;
            TextView message=null;

            ImageView imageViewStatus=null;
            Button button=null;

            final RowData rowData= getItem(position);
            if(null == convertView)

            {
                convertView = layoutInflater.inflate(R.layout.record, null);
                holder = new ViewHolder(convertView);
                convertView.setTag(holder);
            }

            holder = (ViewHolder) convertView.getTag();

            button=(Button)holder.getProceedButton();


            message=holder.getEmail();
            message.setText(rowData.mEmail);

            title = holder.getName();
            title.setText(rowData.mName);

            detail = holder.getAddress();
            detail.setText(rowData.mAdress);                                                    

            data= holder.getPhoneNumber();
            data.setText(rowData.mMobile+" "+rowData.mOffice);

            imageViewStatus=holder.getImage();

            System.out.println("This is the gender "+rowData.mgender);
            if(rowData.mgender.equalsIgnoreCase("male"))
            {
                imageViewStatus.setImageResource(R.drawable.male);
}

            else{
                imageViewStatus.setImageResource(R.drawable.female);
                System.out.println("Button Visibility"+button.getVisibility());

                button.setVisibility(View.GONE);

            }

            return convertView;
        }
  • 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-18T11:59:11+00:00Added an answer on June 18, 2026 at 11:59 am

    Keep in mind that ListView children are always reused while you scroll them. When you set a property according to some condition in getView(), you have to revert that property when the condition isn’t met. You’re hiding the button when the gender is female, but when this view gets reused to populate a male contact, the button is still invisible and you have to set it as visible again.

    Check this out:

    if(rowData.mgender.equalsIgnoreCase("male"))
    {
        imageViewStatus.setImageResource(R.drawable.male);
        button.setVisibility(View.VISIBLE); // You need to add this line in your code
    } else {
        imageViewStatus.setImageResource(R.drawable.female);
        button.setVisibility(View.GONE);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to parse a JSON response with jQuery but it's not working. This
I am trying to parse Json response from This URL . I have used
I am trying to parse the JSON response from Wordnik's API. This is built
I am trying to parse a JSON response from a server using javascript/jquery. This
I am trying to parse a Json response from my webservice. I receive this
BackGround : I am trying to parse this simple json response in my SenchaTouch
I'm trying to parse this JSOn with multiple entries of node tag: { nodes:
I'm trying to parse this XML string: <?xml version=1.0 encoding=UTF-8 standalone=no?> <response type=success> <lots>
First: this is my first time using GSON. Trying to parse some JSON, I
I am trying to parse through a JSON response for customer data (names and

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.