[mono-android] persistent putextra etc
John Murray
john at murray.gb.com
Wed Mar 23 13:07:03 EDT 2011
Thanks Jon and all
Now cooking with statics
Your explanation saved me a lot of time Jonathan
-----Original Message-----
From: Jonathan Pryor [mailto:jpryor at novell.com]
Sent: 23 March 2011 14:46
To: john at murray.gb.com; monodroid at lists.ximian.com
Subject: Re: [mono-android] persistent putextra etc
On Mar 23, 2011, at 6:10 AM, john Murray wrote:
> I cannot figure out how to pass the instance of the class using bundle and
putextras
Serialize to XML/JSON and deserialize on the other side. :-)
Or just don't do that; see Morten Nilsen's followup about using static
members.
> It seems to be something to do with parcelable data - ie. My vehicle
class needs to be parcelable
> I've found something on this but it might as well be Fermatts last theorem
Parcelable is yet another serialization mechanism (somewhat, but not quite
like, XML/JSON/Binary serialization). It exists because Intents can be sent
to different processes, and thus there needs to be some cross-process
serialization mechanism to send higher-level messages.
The problem is that you can't currently implement IParcelable in Mono for
Android, so it's moot (because IParcelable requires that you provide a
static CREATOR field, and mandroid.exe is currently very limited about what
it generates in .java files).
Consequently, if the data you're sending is within the same process, just
use a static variable or data on the Application object. Otherwise, if you
need to send this data to a separate process, some string-based
serialization mechanism is probably best.
- Jon
More information about the Monodroid
mailing list