What are context in an xamarin android

Context allows access to application-specific resources and classes, as well as calls for application-level operations such as launching activities, broadcasting and receiving intents, etc. Context are basically use to represents environment data and the It provides access to things such as databases.


The Context is often needed in an Android application and allows your code to be run within an Activity.
The Context allows you for example:
  • to access Android services,
  • to access Application resources like images or styles,
  • to create views
  • to assign gestures to an Activity

Without Context, often code does not get accepted by the IDE or makes your code getting ignored while running the app. Luckily, all methods that I used so far have been telling me if they want a Context, so you need only learn to find out if you need Context for the Activity resources or Application resources.

No comments:

Post a Comment