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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:06:56+00:00 2026-06-09T22:06:56+00:00

I am downloading images from server into the ListView , now to perform this

  • 0

I am downloading images from server into the ListView , now to perform this task i am using ImageDownloader example code. so far its working fine.

But i want to save images of ListView in a SD card but i am confused when to store the images as images are being downloaded Asynchronously and because of ViewHolder pattern its little tough for me to judge.

Once i stored it in a SD card next time i want to read it from memory only.

ImageDownload is storing bitmap in cache and fetching it from there once it gets downloaded.But the problem is its behavior is not predictable.

Sometimes it downloads from server and sometimes from cache.

so can anyone help me in finding what is the proper place to store the images in sd card once.

  • 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-09T22:06:57+00:00Added an answer on June 9, 2026 at 10:06 pm

    Modify your ImageDownloader class to save the image like this :

    • add a parameter to download method like :
     download(String url, ImageView imageView, Boolean saveData)
    
    • make a global variable saveData in yout ID class :

    private Boolean saveData;

    and store in it the value given as parameter in download dmethod:

    this.saveData = saveData;

    • and the BitmapDownloaderTask’s onPostExecute method should look like this :

    @Override
    protected void onPostExecute(Bitmap bitmap) {
    if (isCancelled()) {
    bitmap = null;
    }

            addBitmapToCache(url, bitmap);
    
            if (saveData == true) {
                try {
                    FileOutputStream out = new FileOutputStream(path);
                    bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
    
            if (imageViewReference != null) {
                ImageView imageView = imageViewReference.get();
                BitmapDownloaderTask bitmapDownloaderTask = getBitmapDownloaderTask(imageView);
                // Change bitmap only if this process is still associated with it
                if (this == bitmapDownloaderTask) {
                    imageView.setImageBitmap(bitmap);
                }
            }
        }
    

    where path is the path were you want to save the image .

    and next time before you want to load the image you have to see if it is already downloaded and load it from the path otherwise call ImageDownloader.

    that’s it! enjoy!

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

Sidebar

Related Questions

I am downloading images from server into the ListView and storing it into SD
I'm using this code for downloading image from server: public Bitmap getBitmap(String path){ URL
i am downloading tiff images from WAMP server using our Flex AIR client. Using
In my application I am downloading some images from the web (from my server
I have iphone application in which I am downloading images from server & displaying
I have this thread which downloads a few images from the server. So once
Task Downloading binary files from a remote media processing server to a web server.
I have folowing problem. I use curl for downloading images from server. I generating
I am downloading images from server and saving them locally in my iphone,But sometimes
I am downloading images from a server with the help of a Thread Pool.

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.