The system does nothing special with the contents of .obj, so it what it
holds is changing then your code must be modifying it somewhere.

Anyway I wasn't suggesting that you cache the object + contents, but just
the object that you fill in with its contents each time you send it.  Though
honestly, if you are allocating at least one other object (such as a String)
to send the message, I don't know that I would worry much about also
allocating the container object.

On Wed, Feb 18, 2009 at 3:45 PM, Al <[email protected]> wrote:

>
> The data is always changing (it's a chat client) so it wouldn't be
> possible to save them before hand. I've tried making an object array
> as a member variable of the class and populating that each time with
> the data I need to send, but it never worked, the data would go
> missing before it reached my handler.
>
> On Feb 18, 8:39 pm, Dianne Hackborn <[email protected]> wrote:
> > You can define a class able to hold of the data you will need, and keep a
> > small pool of them around to re-use the objects instead of allocating one
> > each time.  (This is what is already done for Message and MotionEvent.)
> >
> > On Wed, Feb 18, 2009 at 11:56 AM, Al <[email protected]> wrote:
> >
> > > I need to send some stuff to my gui thread and I'm doing this via a
> > > handler. But I regularly need to send more then 1 piece of information
> > > in one go and using the single Message.obj field won't work unless I
> > > use an Object array or something. I'd really like to avoid this so
> > > there is less object creation, is there a better I can send lots of
> > > info in one go? The amount of information I send can be of variable
> > > length, 1, 2 or 3 depending on the situation.
> >
> > > Thanks.
> >
> > --
> > Dianne Hackborn
> > Android framework engineer
> > [email protected]
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support.  All such questions should be posted on public
> > forums, where I and others can see and answer them.
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

--~--~---------~--~----~------------~-------~--~----~
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to