App Components HelloWorld by Manasi Dharne - February 25, 2019February 25, 20190 App components are an entry point through which the system or a user can enter into your app. Components There are four different types of app components: ActivitiesServicesBroadcast receiversContent providers Contents 1.Activities Android Activity is Front end view of an app.It represents a single screen with a user interface. For example, an whatsapp app might have one activity that shows a list of all contacts, another activity to show all chats, and another activity to update status. Although the activities work together to form a cohesive user experience in the whatsapp app, each one is independent of the others. Intent: An Intent is a simple message object that is used to communicate between android components such as activities, content providers, broadcast receivers and services. Intents are also used to transfer data between activities. Use of Intent: For Launching an ActivityTo start a New ServiceFor Broadcasting MessagesTo Display a list of contacts in List View 2.Services Android service is a component that is used to perform operations on the background such as playing music, handle network transactions, interacting content providers etc. It does not provide a user interface. For example, a service might play music in the background while the user is in a different app, or it might fetch data over the network without blocking user interaction with an activity. 3.BroadCast Receivers Broadcast Receivers simply respond to broadcast messages from other applications or from the system itself. for example, a broadcast announcing that the screen has turned off, the battery is low, or a picture was captured. 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. 4.Content Providers Content provider component supplies data from one application to others on request. This component is useful for reading and writing data that is private to your app and not shared. Share this:Click to share on Twitter (Opens in new window)Click to share on Facebook (Opens in new window)MoreClick to share on LinkedIn (Opens in new window)Click to share on WhatsApp (Opens in new window)Click to email a link to a friend (Opens in new window)Like this:Like Loading... Related