Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Prochain SlideShare
Android Basic Components
Android Basic Components
Chargement dans…3
×
1 sur 10

Android Components

6

Partager

This is a small tutorial which explains about Android Components in brief.

Livres associés

Gratuit avec un essai de 30 jours de Scribd

Tout voir

Android Components

  1. 1. Android Components - Atul Palandurkar
  2. 2. Android Components There are 4 basic components of an Android Application :  Activity  Service  Broadcast Receiver  Content Provider http://aatul.me - Atul Palandurkar
  3. 3. Activity  An Activity represents a single screen with UI.  Activity class takes care of creating a window in which UI can be placed with the method setContentView(View)  While activities are often presented as full screen windows, they can also be used as floating windows or embedded inside another activity.  The onCreate(Bundle) is where you initialize your activity.  All activity classes must have a corresponding <activity> declaration in their package’s AndroidManifest.xml http://aatul.me - Atul Palandurkar
  4. 4. Activity Life Cycle http://aatul.me - Atul Palandurkar
  5. 5. Activity Stack Start Start Navigate Activity 2 Activity 3 back Foreground activity Activity 3 Activity 1 Activity 1 Activity 1 Activity 1 Activity 2 Activity 2 Activity 2 Back Stack Activity 3 Activity 3 destroyed http://aatul.me - Atul Palandurkar
  6. 6. Service A Service is a component that runs in the background to perform long-running operations or to perform wok for remote processes.  Each service class must have a corresponding <service> declaration in its package’s AndroidManifest.xml  A service does not provide user interface.  Another component, such as an activity, can start the service and let it run or bind to it in order to interact with it. http://aatul.me - Atul Palandurkar
  7. 7. startService() Service Starts the service Life Cycle onStartCommand() Starts actual operation Context.bindService() Obtains data from persistent onStop() OR Context.stopService() Stops the service, ready to get destroyed onDestroy() http://aatul.me - Atul Palandurkar
  8. 8. Broadcast Receiver  They listen to broadcast intents.  They must be registered (either in code or within the AndroidManifest.xml).  Intent Filters must be used to specify which Intents it is listening for.  A broadcast receiver can be registered using multiple intent filters.  The onReceive() method be overridden to perform any operations. http://aatul.me - Atul Palandurkar
  9. 9. Content Provider  Content providers are one of the primary building blocks of Android applications, providing content to applications.  They encapsulate data & provide it to applications through a single interface called ContentResolver.  A content provider is only required if there us a need to share data between multiple applications.  For example, the contacts data is used by multiple applications & must be stored in a content provider. http://aatul.me - Atul Palandurkar
  10. 10. Thank You Atul Palandurkar Blog : http://aatul.me Training : training@shardainfotech.com Website : http://shardainfotech.com Contact : 091-9766210353

×