Course Content

Course Content

Description

Android Components and Activities

In this Video tutorial, we will see what is components in Android, components play very important role in any Android application, because components are its base. Android application can be created with the help of one or more components.

Now we will see what are the main component of Android and how many types are there.

The first component is 'Activity', the second one is 'Service', the third one is 'Broadcast Receiver', and finally 'Content Provider'. These four components are the base of Android application. So what are these four components and how do they work, let's see.

 

Components

Description

Activity

They dictate the UI and handle the user interaction to the smart phone screen.

Services

They handle background processing associated with an application.

Broadcast Receiver

They handle communication between Android OS and applications.

Content Provider

They handle data and database management issues.

 

So now we will see how Android Component works.

Activities

Activity is the most important base of Android application because our main focus is what exactly user wants to do and what is their requirement.

We can take a simple example, we can see, send, compose an email in our email application and can also read new mail. Now the activity is designed in such a way that we have to extend the main class of activity to an extent.

  • Android System initiates its program with an Activities starting with a call on Create() call-back method.
  • There is a sequence of call-back methods that start up an activity.
  • There can be more then 1 activity in application.
  • Any one of them will be defined as main activity.

 

If you take the example of an email application, there may be an activity in it, in which I can check the mail that has arrived in my inbox, another activity can be to compose the email, then according to the user's requirements, you can divide activities, and we will make any one of that activity a 'welcome' activity or 'launch' activity, because as soon as we open the application, that screen will come up.

 

Callback

Description

onCreate()

This is the first callback and called when the activity is first created.

onStart()

This callback is called when the activity becomes visible to the user.

onResume()

This is called when the user starts interacting with the application.

onPause()

The paused activity does not receive user input and cannot execute any code and called when the current activity is being paused in the previous activity is being resumed.

onStop()

This callback is called when the activity is no longer visible.

onDestroy()

This callback is called before the activity is destroyed by the system.

onRestart()

This callback is called when the activity restarts after stopping it.

 

FAQs

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
297K+ Downloads
App Download Section Circle 1
4.5 Rating
App Download Section Circle 2
10K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere