Android Question best way for download by httputils in a loop for

Discussion in 'Android Questions' started by ArminKH, May 16, 2015.

  1. ArminKH

    ArminKH Well-Known Member

    Hi
    I have a loop for and download a list of pictures
    Now my question is:
    Which way is better?
    1.dim and initialize a job for each item in loop for(i dont want to download all items together)
    2.Use single job for all items
    I looking for a way which have less cpu and ram usage
    I know we have image downloader class but for some reason thats not usable for me
    Please suggest best way
    Thanx
     
  2. RandomCoder

    RandomCoder Well-Known Member Licensed User

    You should not hold the main thread in a For Next loop. Instead use the job done event to check if another image requires downloading and trigger it from there.
     
    ArminKH and DonManfred like this.
  3. ArminKH

    ArminKH Well-Known Member

    My for next loop is for add search relust,my download start again from jobdone
    My question is about dim job
    At first i dim a job and initilize that then start download
    Now if job success then we must dim a job with same name ? Or is better to use first job and not dim new one?
    Which way is fast and use less cpu and ram?
     
  4. ibra939

    ibra939 Active Member Licensed User

    there many thing want to do but still i don't see one example for donloading mp3 or media as perfect .
     
    ArminKH likes this.
  5. RandomCoder

    RandomCoder Well-Known Member Licensed User

    I declare and initialise the Http job in a function each time. I've never had any problem in doing this as I believe it is only stored as a local object and so only held in memory for as long as it is referenced. I could be wrong with my explanation, but as I said I've not had any problems in doing it this way.
     
  6. DonManfred

    DonManfred Expert Licensed User

    ALWAYS create a new instance of the httpjob. You can give it the same name.
     
    ArminKH likes this.
  7. ibra939

    ibra939 Active Member Licensed User

    why nothing example ?
     
    ArminKH likes this.
  8. RandomCoder

    RandomCoder Well-Known Member Licensed User

    DonManfred likes this.
  9. ArminKH

    ArminKH Well-Known Member

    Ooooops !
    Thanx all :)
     
    RandomCoder likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice