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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:14:45+00:00 2026-06-11T09:14:45+00:00

I am using AsyncTask to download images from remote server and show them in

  • 0

I am using AsyncTask to download images from remote server and show them in a ListView. I am using this blog to accomplish it and everything is working fine.

The only problem in this blog is that a ColorDrawable is being shown while the image is being downloaded. But I want to show a default image while the image is being downloaded. Just like in the attached image below:

image list

Here you can see that:

  1. Images for Taylor Loother and Oye Oye have already been downloaded.
  2. There is no image for Gopala Govinda on the server , so I am not
    downloading image for him from the server and showing Default image.
  3. For Hellboy, the image is still being downloaded , so a color
    background (the thin black line) is showing up against his name. I
    don’t want to show this black line . I want to show the default
    image
    just like in front of Gopala Govinda until the image is not
    loaded from the server for Hellboy.

    Does anyone have any idea how to do that?

  • 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-11T09:14:45+00:00Added an answer on June 11, 2026 at 9:14 am

    I think what you want to do is to have the DownloadedDrawable class extend BitmapDrawable instead of Drawable and then choose one of the appropriate super constructors to specify your default image bitmap:

    /**
     * A fake Drawable that will be attached to the imageView while the download is in progress.
     *
     * Contains a reference to the actual download task, so that a download task can be stopped
     * if a new binding is required, and makes sure that only the last started download process can
     * bind its result, independently of the download finish order.</p>
     */
    private static class DownloadedDrawable extends BitmapDrawable {
        private final WeakReference<BitmapDownloaderTask> 
           bitmapDownloaderTaskReference;
    
        private DownloadedDrawable(BitmapDownloaderTask bitmapDownloaderTask,
           Resources resources, Bitmap bitmap) {
            super(resources, bitmap); // you'll have to provide these
            bitmapDownloaderTaskReference =
                new WeakReference<BitmapDownloaderTask>(bitmapDownloaderTask);
        }
    
        public BitmapDownloaderTask getBitmapDownloaderTask() {
            return bitmapDownloaderTaskReference.get();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a code which download the apk from server by using Asynctask, Currently
I'm using an AsyncTask to download Images for my Listview, because I dont want
I am using this code (inside an AsyncTask) to download files: URL u =
i am using asynctask to fetch images from given url.these images are displaying in
I have an activity which downloads images in background in a listView using AsyncTask,
I'm using AsyncTask to download and parse XML content from i-net. Downloading and parsing
I am using a AsyncTask to download a file from a URL in Android.
I am using AsyncTask to download different mp3's from webview. When I track my
Have the following asynctask that i'm using to download some images. Works fine except
I'm using AsyncTask to get all the data my app needs from a server.

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.