[mono-android] Being driven insane....
Jonathan Pryor
jonp at xamarin.com
Wed Nov 23 10:30:16 EST 2011
On Nov 23, 2011, at 10:20 AM, Paul Johnson wrote:
> I have a class called foo with [Serialize] above it to serialize it.
>
> In the main tab constructor, I have
>
> Bundle b;
> b.PutSerializable("data", foo);
> intent.PutExtras(b);
This is not what you think it is. Java.IO.ISerialzable != System.Runtime.ISerializable. They have _completely_ different semantics, not least is that you can't actually, properly, implement Java.IO.ISerializable at this time, as it requires private Java methods which can't be generated right now.
In short, this won't work.
> I don't know what the difference is between a C# and Java serializable object is.
A C# [Serializable] uses .NET Serialization. A Java serializable uses Java serialization. :-)
Same basic idea, completely different types, semantics, requirements...
> I'm trying to find a simple way to pass a class between tabs and it's annoying me now!
If all your tabs are in the same process, just use a `public static` field or similar.
If a tab will be in a different process, the easiest route is XML serialization, or a ContentProvider.
- Jon
More information about the Monodroid
mailing list