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

  • Home
  • SEARCH
  • 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 8393643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:51:01+00:00 2026-06-09T19:51:01+00:00

I have a GridView with many ImageView items. For each of the item I

  • 0

I have a GridView with many ImageView items. For each of the item I lazy load a thumbnail imahge from WebService using HttpClient. I crate a new HttpClient for every image i download. The thumbnails are 2-4kB small. I noticed the download is slow, images are loaded 1 by 1 and each of them is downloaded in 1s. Is it possible to speed up the process?

public Bitmap downloadPhoto( String url ) {

    try {
        HttpParams params = new BasicHttpParams();
        params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
        HttpClient client = new DefaultHttpClient(params);
        HttpUriRequest request = new HttpGet(url);
        if ( this.authToken != null ) {
            request.setHeader(AUTH_TOKEN_NAME, authToken);
        }
        request.setHeader(USER_AGENT_PROPERTY, AGENT_NAME);

        HttpResponse response = client.execute(request);
        if ( response.getStatusLine().getStatusCode() == HttpStatus.SC_OK ) {
            // read the content
            long contentLenght = response.getEntity().getContentLength();
            BufferedHttpEntity bufferedHttpEntity = new BufferedHttpEntity(response.getEntity());

            Bitmap image = BitmapFactory.decodeStream(bufferedHttpEntity.getContent());
            Log.e(TAG, "Bitmap != null " + (image != null) );
            return image;
        } else {
            Log.e(TAG, "HTTP ERROR while executing method: downloadImage: " + response.getStatusLine().getStatusCode());
        }

    } catch (Exception e) {
        Log.e(TAG, "Exception while executing method: downloadImage: " + e.getMessage());
        return null;
    }
    return null;
}
  • 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-09T19:51:03+00:00Added an answer on June 9, 2026 at 7:51 pm

    I would recommend using the AndroidHttpClient which has some good default settings, including the ThreadSafeClientConnManager and thus can be shared between threads. You can create a custom AsyncTask and pass the client in the c’tor.

    You shouldn’t need to recreate the client each time then which also takes time – just listen in for lifecycle events and shutdown/recreate as necessary.

    Whats wrong with multiple connections being established? Is this a design requirement?

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

Sidebar

Related Questions

I have a GridView control that for each item has a Hyperlinkfield with a
I have many controls in same gridview cell. I am using the following code.
I have a Gridview where i have many images that I get from url
I have a GridView using LinqDataSource to populate data from table Tickets . The
ok i have a project which has many gridview in its pages... now i
I have a radiobutton column in a gridview, inside many nested asp tables. I
I am using ASP.NET C# on VS2005. I have a GridView table with a
I have a gridview that contains around 16 ItemTemplate columns. The values in each
I have a gridview that is bound to a datasoure on page load. The
I have a gridview and binding the records in it from a list.I need

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.