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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:55:12+00:00 2026-06-16T08:55:12+00:00

I have a listview that displays an image and a text from internet. My

  • 0

I have a listview that displays an image and a text from internet.
My intention is that this image, in addition to showing a imageview, is the background image of listview row.
This works but with problems.

In the listview adapter I have for the imageview:

imageLoader.DisplayImage (song.get (principal.KEY_PICTURE) my_imageView);

and to use the image in the LinearLayout:

imageLoader.DisplayImageLinear (song.get (principal.KEY_PICTURE) my_linearLayout);

This calls the following method:

public void DisplayImageLinear (String url, LinearLayout linearbck)
{
Bitmap bitmap = memoryCache.get (url);
Drawable d = new BitmapDrawable (bitmap);
if (bitmap! = null) {
linearbck (d);
}
else
{ linearbck.setBackgroundResource (R.drawable.list_selector); }
}

My problem is that the background images of the rows of the listview are only visible when the listview slip and rows out of the screen and re-enter …

I hope I’m explaining correctly .. here a picture explaining the problem

enter image description here

I tried to use linearbck.invalidate (), but without success

I sincerely appreciate any help

thanks

Best regards

EDIT:

add the adapter. Thanks 🙂

public class lstAdapter extends BaseAdapter {

    private Activity activity;
    private ArrayList<HashMap<String, String>> data;
    private static LayoutInflater inflater=null;
    public ImageLoader imageLoader; 

    public MinAdapter(Activity a, ArrayList<HashMap<String, String>> d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }


    public int getCount() {
        return data.size();
    }

    public Object getItem(int position) {
        return position;
    }

    public long getItemId(int position) {
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;


        if(convertView==null)
            vi = inflater.inflate(R.layout.list_row, null);


        ImageView thumb_image=(ImageView)vi.findViewById(R.id.list_image); 
        ImageView photo_user =(ImageView)vi.findViewById(R.id.photoUser); 
        LinearLayout background =(LinearLayout)vi.findViewById(R.id.background);

        HashMap<String, String> song = new HashMap<String, String>();
        song = data.get(position);


        imageLoader.DisplayImage(song.get(principal.KEY_AVATAR_AUTOR_ENTRADA), thumb_image);
        imageLoader.DisplayImage(song.get(principal.KEY_PICTURE), photo_user);
        imageLoader.DisplayImageLinear(song.get(principal.KEY_PICTURE), background);


        return vi;
    }

    @Override 
    public boolean isEnabled(int position) 
    { 
        if(principal.asynTaskEnUso.equals("yes")){ 
            return false; 
        } else { 
            return true; 
        } 

    } 

}
  • 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-16T08:55:13+00:00Added an answer on June 16, 2026 at 8:55 am

    We when we see the source of ImageLoader, when there is no photo downloaded in cache, it queues the photo.

    => You are not queuing the photo.

    When photo is downloaded, it is set to the ImageView, from the callback.

    =>You may (or most probably) not be setting it to the LinearLayout as background.

    Now your problem:

    My problem is that the background images of the rows of the listview
    are only visible when the listview slip and rows out of the screen and
    re-enter …

    For the first time, cache is empty, it doesn’t find required photo, so it goes and put it to download, since you have not implemented and queued for the LinearLayout to set as background in the callback. it doesn’t shown, but when you scroll ListView and get back, it finds the image for the first time (because it was downloaded and cached) and set it as background.

    Solution:

    Maintain and set some flags to Keep track of your LinearLayout‘s reference and while download completed set it as background.

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

Sidebar

Related Questions

I have a listview that you select a row/item on. This is linked to
I have a ListView that displays images loaded from the SD (JPGs previously taken
I have a listview that displays player names from a datastore class and i
i have a listview that displays images from a directory and it is loading
I have a ListView that displays a link button. I need the link button
I have a ListView that displays a shopping cart. It was working fine until
I have a listview that highlights a row when you mouseover it with the
In one of my Activities I have a ListView that displays a list of
I have a fragment which pulls down data from a webservice and displays this
I have found this example Lazy load of images in ListView from Fedor which

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.