You are making an http request every second?  Though I don't know what
you are doing, that seems way too frequent to me.  This will be very
hard on the battery, effectively causing the device to keep its radio
turned on in a high power state for the entire time you are running.

On Sep 3, 2:20 am, barbapapaz <[EMAIL PROTECTED]> wrote:
> Hello
>
> I have question about efficiency in loop. In my app I have loop called
> with sceduler each second. In this loop I launch request with
> httpclient, I must cronstruct an entity with MultipartEntity.
>
> this procedure explain here (http://groups.google.com/group/android-
> developers/browse_thread/thread/e4230ed22c196772/1284daa5723acd0c?
> lnk=gst&q=MultipartEntity#1284daa5723acd0c)
>
>                         ContentBody[] parts =   {        new
> StringBody(Float.toString(latitudeMin)),
>                                                                           new 
> StringBody(Float.toString(latitudeMax)),
>                                                                           new 
> StringBody(Float.toString(longitudeMin)),
>                                                                           new 
> StringBody(Float.toString(longitudeMax)),
>                                                                           new 
> StringBody(dateMin),
>                                                                           new 
> StringBody(dateMax),
>                                                                           new 
> StringBody(noteMin),
>                                                                           new 
> StringBody(categories)
>                                 };
>
>                         MultipartEntity getMessagesRequestContent = new 
> MultipartEntity();
>                         getMessagesRequestContent.addPart("latitudeMin", 
> parts[0]);
>                         getMessagesRequestContent.addPart("latitudeMax", 
> parts[1]);
>                         getMessagesRequestContent.addPart("longitudeMin", 
> parts[2]);
>                         getMessagesRequestContent.addPart("longitudeMax", 
> parts[3]);
>                         getMessagesRequestContent.addPart("dateMin", 
> parts[4]);
>                         getMessagesRequestContent.addPart("dateMax", 
> parts[5]);
>                         getMessagesRequestContent.addPart("noteMin", 
> parts[6]);
>                         getMessagesRequestContent.addPart("categories", 
> parts[7]);
>
> In this code there are lot of "new" and the garbage collector is often
> called!
> MultipartEntity and StringBody objects aren't clear or erase function,
> I must called new each loop!
>
> Do you think that is no problem?
> Do you think that I musn't use this new (do you have solution)?
>
> MultipartEntity and StringBody objects are in an opensource library
> (code 
> herehttp://hc.apache.org/httpcomponents-client/httpmime/xref/index.html).
> Do you think that I must write clear funtion to don't called new
> function (and recompile)?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to