28

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.

nbro
  • 15,395
  • 32
  • 113
  • 196
ADJ
  • 1,182
  • 2
  • 14
  • 26
  • 10
    Duplicate of question here: http://stackoverflow.com/questions/3572463/what-is-context-in-android well that's context, Google's docs explain Activities and Intents pretty well, I recommend read them through a few times and then post more specific questions. – ShadowGod Nov 18 '11 at 09:23

3 Answers3

40

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.

nbro
  • 15,395
  • 32
  • 113
  • 196
K.Muthu
  • 1,232
  • 1
  • 17
  • 38
  • It seems to me that activities exist only as instances during run time. Though they're java classes which are layouted through xml files. Is this correct? – carloswm85 Nov 03 '20 at 22:52
20

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.

Guillaume
  • 22,694
  • 14
  • 56
  • 70
7

Definitions WIKIPEDIA better information than Stackoverflow


But i believe stackoverflow gives better and precise answers for definitions. Here is a gathered information from many places [My source-Programmers Universe]


enter image description here


Community
  • 1
  • 1
Devrath
  • 42,072
  • 54
  • 195
  • 297