A piece of code with a well-defined life cycle e.g. Activity, Receiver, Service, etc, is what an android component can be simply understood as. Activities, views, intents, services, content providers, fragments, and AndroidManifest.xml are the core building blocks or fundamental components of android.
Activity:
Being similar to a Frame in AWT, an activity as a class represents a single screen. It is a core building block, i.e., the fundamental component of android.
View:
The UI element including button, label, text field, etc, and anything that one can see is a view.
Intent:
Along with invoking the components, the Intent is used for many purposes including:
- Start the service
- Launch an activity
- Display a web page
- Display a list of contacts
- Broadcast a message
- Dial a phone call etc.
Example: To view the webpage:
Intent intent=new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse("http://www.test.com")); startActivity(intent); |
Service:
Being a background process the service can run for a long time.
The local and remote are the two types of services. Within the application, the local service is accessed. While from other applications running on the same device the remote service can be accessed remotely.
Content Provider:
To share the data between the applications, the Content Providers are used.
Fragment:
Being a part of an activity, one or more fragments can be displayed on the screen at the same time by the activity.
AndroidManifest.xml:
Information about activities, content providers, permissions, etc is in the AndroidManifest.xml which is like the web.xml file in Java EE.
Android Virtual Device (AVD):
To test an android application without using a mobile or a tablet, the Android Virtual Device or AVD is used. To emulate different types of real devices, an AVD can be created in different configurations.