Tuesday, 3 January 2012

Basic Building blocks of Android

Building blocks of Android



There are 4 building blocks in android:
1. Activity     
2. Service  
3. Content Provider
4. Broadcast Receiver


 Activity
           It is a component in which user can interact with User interface or screen.
 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.

Service
       It perform background tasks without providing an UI. They can notify the user via the notification framework in Android. Each service class must have a corresponding <service> declaration in its package's AndroidManifest.xml.

ContentProvider
      Content providers store and retrieve data and make it accessible to all applications. They're the only way to share data across applications; there's no common storage area that all Android packages can access.. Android contains a SQLite DB which can serve as data provider.



BroadCast/Intent  Receiver
       A broadcast receiver is a class which extends BroadcastReceiver and which is registered as a receiver in an Android Application via the AndroidManifest.xml file.This class will be able to receive intents. Intents can be generated via the Context.sendBroadcast() method.The class BroadcastReceiver defines the method onReceive(). Only during this method your broadcast receiver object will be valid, afterwards the Android system will consider your object as no longer active. Therefore you cannot perform any asynchronous operation.

No comments:

Post a Comment