Hi Thomas

> > At the moment you may want to replace the existing MultipartBody instance
> > with a new one by initializing it with a new collection of Attachments,
> > getting some from the immutable collection and adding some new
> attachcment
> > to the new collection
>
> Replacing the entire MultipartBody is quite a bit of work.  Generating new
> attachments, copying all the other meta-data, etc.  In this case, I rather
> live with the above hack.
>
> I was thinking you could just do

List<Attachment> atts = body.getAllAttachments();
List<Attachment> newAtts = new ArrayList<Attachment>();
newAtts.add(atts.get(0));
// replace the 2nd one
newAtts.add(new Attachment(...));
newAtts.add(atts.get(2));
MultipartBody newBody = new MultipartBody(newAtts);
and then replace the original one with newBody on the message...

Not sure if it is what you're after, especially given the Dan's fix

cheers, Sergey


> Thanks,
> Thomas
>
>

Reply via email to