Narcís,
You can derive from Android.App.Application, this will give you a singleton class which can hold global application state. For such a class you need to use the [Application] attribute - this will add the appropriate entry in the AndroidManifest.xml. Storing the instance of an activity doesnt seem much use in Android because activities are created and destroyed regularly by the system in accordance with the activity lifecycle. So if you want to access a property of one activity from another activity then theres a very good chance that the target activity will be invalid. This might be different with activity groups, I havent used them, but in general Ive found it best to store data in an instance-independent manner. The same things applies with Views. Suppose you had 2 views within an activity that both cause another activity to be shown, and you wanted to remember which view had triggered this new activity. Within Windows you might have a member variable of the calling activity called _triggeringView and youd access this when you returned to the original activity. With Android thats no use because you have to assume that the original activity will be destroyed during the whole process. One way around this is to store something like triggering view was the 2nd view at the application level or as part of the saved state bundle in the activity. So youre just storing an integer. Clear as mud? I hope it helps anyway, the implications of the activity life cycle are very far reaching if you are porting an application from, for example, .NETCF. Andy From: monodroid-boun...@lists.ximian.com [mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Narcís Calvet Sent: 19 July 2011 12:28 To: 'Discussions related to Mono for Android' Subject: Re: [mono-android] Getting objects from an intent Searching a little bit and looking for whats available in IParcelable it seems it is not complete in Mono for Android so I guess I should discard this option. Any other ideas? Thanks! Best Regards, Narcís Calvet Steema Software http://www.steema.com <http://www.steema.com/> http://twitter.com/SteemaSoftware https://www.facebook.com/SteemaSoftware From: monodroid-boun...@lists.ximian.com [mailto:monodroid-boun...@lists.ximian.com] On Behalf Of Narcís Calvet Sent: dimarts, 19 / juliol / 2011 11:04 To: 'Discussions related to Mono for Android' Subject: [mono-android] Getting objects from an intent Hello, I have created a custom activity which I use in an ActivityGroup using Intents. How can I get the instance of my custom activity the intent has created to be able to use its properties and methods? I read I may need to use Serializable or Parcelable interfaces but havent succeed on this so far. Monodroid examples on this would be great! Thanks in advance. Best Regards, Narcís Calvet Steema Software http://www.steema.com <http://www.steema.com/> http://twitter.com/SteemaSoftware https://www.facebook.com/SteemaSoftware
_______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid