'Serializable' is ill-suited for persistence to disk.  'Parcelable' isn't 
much better.  They're intended for in-process or inter-process transfers of 
data, not persistence.  Don't use them.  

'Serializable', in particular, imposes a huge maintenance burden, in that it 
locks down implementation of the class /ad aeternam/.  Read Joshua Bloch's 
entire chapter on serialization in /Effective Java/ for the relevant 
warnings, dangers and gotchas.  There are many.  Really.  Make sure you 
really know what you're doing before using 'Serializable'.

That said, the methods that support serialization can work around your 
trouble, potentially.  You sort of hand-roll the parts not provided upstream 
for you by the API.
<http://download.oracle.com/javase/7/docs/api/java/io/Serializable.html>

Don't walk into serialization without doing your homework first.  Lesson 
one: it isn't good for persistence.  Lesson two: it isn't cheap.  Or maybe 
it's the other way around.

-- 
Lew

On Wednesday, October 5, 2011 8:20:52 AM UTC-7, Jean-Michel wrote:
>
> No, I am serialising to disk. 
>
> Do you think it could work out? 
>
> Any idea how to use Parcelable ? 
>
> Many thanks, 
> Jean-Michel 
>
> On 5 oct, 16:43, Daniel Drozdzewski <daniel.dr...@gmail.com> 
> wrote: 
>
> > Now luckily for you, Location in Android implements Parcelable 
> > interface, which could be of help, depending where are you sending to 
> > and receiveing from your Leg/Location related data. 
> > If it is within the same machine between a service and an activity, 
> > then you are fine.  If you are passing it via network, you need to 
> > implement a DTO, that implements Serializeable and holds all the 
> > necessary data that you depend on. You then pass that DTO and with its 
> > help you create new Location object at the receiving end. 
> > 
> > HTH 
> > 
> > -- 
> > Daniel Drozdzewski

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to