Introduction to Android components

Android Application Components:

Activities:-

An activity in Android represents a single screen with which a user can interact with.
An application can have more than one Activity and each Activity operates independently, but can be linked to one another and each Activity you create must be defined in your application’s manifest file.
Each Activity in android will be subclass of Activity class defined in Android SDK.
Thus 
public class MainActivity extends Activity
(if MainActivity is the name of the Activity).



Services:-

Long running background process without any need of user interaction is known as Service.
For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an activity.
Each Service in android will be subclass of Service class defined in Android SDK.
Thus 
public class MyService extends Service
(if MyService is the name of the Service).



Broadcast Receivers:-

They handle communication between Android OS and applications.
For e.g the notification that the device battery is low, the sign of earphone as soon as you plug the headset.
Although broadcast receivers don’t display a user interface, they may create a status bar notification to alert the user when a broadcast event occurs.



Content Providers:-

Content Providers are used to share data between the applications.
In android the data cant be shared directly between the two applications


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s