I’m new to mono and working through the Mono For Android tutorials. Can anyone point me to some documentation which explains the meaning of the [Application] tag above my classes?… Here’s my issue:
I have come accross an issue where I have created two seperate classes App1.cs & App2.cs, both of these extend the Application Class (Public Class App1 : Application).. etc.
There is a tag above this declaration [Application] which seems to be causing deployment issues, although it builds fine. If I comment one of these out, the application builds and deploys fine.
I have searched for info on these tags, but as yet cannot find anything in the search, FAQ’s or on google… I guess the square brackes are causing me search problems. Any help would be great…
Thanks
C
In Android applications you can subclass the
Applicationclass in order to maintain global state in your app. An app can have at most oneApplicationclass, and it is shared throughout the app. In order to register yourApplicationclass it needs to be registered in AndroidManifest.xml (this applies to any Android component). Mono for Android uses attributes to generate the manifest during compilation, so any class decorated withApplicationAttributewill generate configuration at build time.Since only one
Applicationclass is allowed, this would explain the problems you are seeing when you try to register two of them. My guess (without having context into what you’re trying to do here) is that you probably want to subclassActivityfor these classes instead ofApplication.