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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:31:41+00:00 2026-05-13T07:31:41+00:00

In my mobile app, I want to load all images from an arraylist of

  • 0

In my mobile app, I want to load all images from an arraylist of links. For each link I create a thread and make httpwebrequest. The problem is that my app run not smooth. It seems to get a delay every time I create new thread and when thread done(when thread done I’ll draw the download img onto background). Here’s my code:

            for (int i = 0; i < NumbersOfImg; i++)
            {
                if (i < ImgObjArr.Count)
                {
                    ThreadStart myThread = new ThreadStart(getUrlImg);
                    Thread t = new Thread(myThread);
                    t.Start();
                }
            }


     private void getUrlImg()
     {
            MyImage mycurrentImg = (MyImage)ImgObjArr[currentMyImg];
            if (currentMyImg < ImgObjArr.Count - 1)
                currentMyImg++;
            myRequest = (HttpWebRequest)WebRequest.Create(mycurrentImg.ImageLink);
            myResponse = (HttpWebResponse)myRequest.GetResponse();

            Stream ImgStream = myResponse.GetResponseStream();
            mycurrentImg.FullImg = new Bitmap(ImgStream);

            this.BeginInvoke(new EventHandler(ImageUpdate));
    }

and method ImageUpdate() will draw the Image. And when app navigate to next row, I will create numbers of threads to continue make webrequest. And delay happen when the old thread not complete but I create new threads. So any suggestion why my app had delay? Thanks in advance.

  • 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-05-13T07:31:41+00:00Added an answer on May 13, 2026 at 7:31 am

    Two possible causes for the slowness:

    1. Depending on the value of ImgObjArr.Count, the code in the question could create a large number of threads, all hogging the CPU. The thread code itself is mostly harmless — they wait for HTTP responses to come back. If a large number of them is run simultaneously, however, you could get CPU peaks that could slow down the UI. That can happen when the requests are being sent, and when responses start coming back and the code creates the Bitmap objects. Context switching has a cost too.

      What number of threads is too high depends on the horsepower of the CPU in question. Given that this is a compact-framework question, that would be the lower-end of the spectrum. You might want to consider limiting the number of background threads to a fixed pool size. Some number between 2-4 might be right. Note that you will not gain much benefit from more threads if the framework limits the number of outgoing connections anyway. (there should be a default limit set by the framework, 2 connections I believe, which you can change. The OS may set a limit too)

    2. The code inside ImageUpdate executes in the UI thread of the app. Any time spent there is time not available for processing input. This directly contributes to UI delays. If there is any code there that could be pushed into the background thread, that would be a worthwhile exercise. If all code that could be move to the background was already moved, reducing the number of background threads could still help, as that reduces the chance of multiple bitmaps hitting the UI thread at the same time and creating chained delays.

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

Sidebar

Related Questions

i want to create a chat app using flex 4.5 mobile project for android
I want to upload photos from Android's mobile gallery from my app. How can
i am in mobile app and i want to create dynamicaly list of checkboxes
I want to make a mobile app that makes a user like a certain
In my jQuery mobile app, I want to display the result from a web
I need your help! I want to create a desktop app and a mobile
I want to build my first mobile app. I am wondering if I should
I want to deveplop an app for Windows Mobile 5.0 and above that can
I want to integrate Facebook with my Birthday App, so I started https://developers.facebook.com/docs/mobile/android/build/ working
For an Android Flash Mobile App I try to grab a Preview-frame from the

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.