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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:57:14+00:00 2026-06-08T13:57:14+00:00

public View getView(final int pos, View arg1, ViewGroup arg2) { ViewHolder holder; View view

  • 0
public View getView(final int pos, View arg1, ViewGroup arg2) {

    ViewHolder holder;
    View view = arg1;

    if (arg1 == null) {
        holder = new ViewHolder();
        System.out.println("Inflating view");
        arg1 = mInflater.inflate(R.layout.inflatefreedownlod, arg2, false);
        holder.im = (ImageView) arg1.findViewById(R.id.imf1);
        holder.tv1 = (TextView) arg1.findViewById(R.id.tvf1);
        holder.tv2 = (TextView) arg1.findViewById(R.id.mini1);
        holder.tv3 = (TextView) arg1.findViewById(R.id.m1);
        arg1.setTag(holder);

    } else {

        holder = (ViewHolder) arg1.getTag();
    }

    holder.tv1.setText(NAME.get(pos).toString());
    holder.tv2.setText(contentName.get(pos).toString());
    holder.tv3.setText(minidescp.get(pos).toString());
    URL url1;

    try {

        url1 = new URL(imurl.get(pos).toString());
        bmp = BitmapFactory.decodeStream(url1.openConnection().getInputStream());
        holder.im.setImageBitmap(bmp);
        //bmp.recycle();

    } catch (Exception e) {
        e.printStackTrace();
    }

    arg1.setOnClickListener(new OnClickListener() {

                            @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            for (int i = 0; i < NAME.size(); i++)
                if (pos == i) {
                    getFreeContent(Cid.get(pos).toString(), Vid.get(pos).toString(), contentName.get(pos).toString());
                }

        }

    });

    return arg1;
}

I see the logcat which shows Inflating View 3 times. I have 3 LinearLayout displayed in listview when i test it on emulator. Why is my view null everytime?. View also is inflated every time. Anything wrong with my code

  • 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-08T13:57:16+00:00Added an answer on June 8, 2026 at 1:57 pm

    If you have three items in your list, and there is space on the screen for three rows in your ListView, getView() will be called three times with a null View to create those three rows. You cannot recycle a row that is presently in use.

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

Sidebar

Related Questions

1.Check condition only display public View getView(final int position, View convertView, ViewGroup parent) {
@Override public View getView(final int position, View convertView, ViewGroup parent) { View v =
this is my getView method: public View getView(final int position, View convertView, final ViewGroup
public View getView(int position, View convertView, ViewGroup parent) { Button btn; if (convertView ==
I try to create listView dynamically from code with: @Override public View getView(int position,
public class ExpAdapter : BaseExpandableListAdapter { private int seed = 1000; public override View
Code: button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // fileReader(); new xyz().execute(); }//
button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { db.update(); } }); On line
Loading class (View): public class Loading extends View { private long movieStart; private Movie
I have a custom view: public class Loading extends View { private long movieStart;

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.