Can somebody please explain to me what an activity, a context and an intent in Android are?
I read the Android documentation, but I could not understand these concepts.
Can somebody please explain to me what an activity, a context and an intent in Android are?
I read the Android documentation, but I could not understand these concepts.
Activity: represents the presentation layer of an Android application, e.g. a screen which the user sees. An Android application can have several activities and it can be switched between them during runtime of the application.
ContentProvider: provides data to applications, via a content provider your application can share data with other applications. Android contains a SQLite
DB which can serve as the data provider
Intents - are asynchronous messages which allow the application to request functionality from other services or activities. An application can call directly a service or activity (explicit intent) or ask the Android system for registered services and applications for an intent (implicit intents). For example, the application could ask via an intent for a contact application. Applications register themselves to an intent via an IntentFilter
. Intents are a powerful concept as they allow the creation of loosely coupled applications.
See the following link: http://www.vogella.de/articles/Android/article.html.
Here is the simplest I could come up with. Of course, as it's simple, it's not entirely accurate or thorough. You need to read more about them to understand really how to use them and all the details.
Activity A page in your application.
Context An abstract class that contains a lot of methods needed by its subclasses: mostly Activity and Service.
Intent A link between two pages. Bundles all the details necessary to do something, send a message to the system, or go to another page of an application.
But i believe stackoverflow gives better and precise answers for definitions. Here is a gathered information from many places [My source-Programmers Universe]