[mono-android] persistent putextra etc
Jonathan Pryor
jpryor at novell.com
Wed Mar 23 10:46:11 EDT 2011
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