Android Components
Skip to main content

Android Components

 

androidarchitecture, components of android architecture, components in android, android basic components, android architecture components, android application components, architecture components android, android components, Type of android components

      Android Components

Android components there we describe the basic android components which is use in android architecture.

Type of android components:- 

  Android is based on the four components:-

1.      Activities   2. Service   3. Broadcast Receiver    4. Content Provider.

 

1.       Activities: Activity is most important components in android. A Activity is represent a single screen with user interface. In short in the application have all the screens are called activity for the developer. there have two type code writing first is front end there developer write a code in xml that  is show the user on the screen there  user interact with application and Other is Backend there developer write a code in Java and Kotlin and  application functionality is defined given in  user interaction screen. Activity is combination of the UI and UX.

 

An activity is implemented as a subclass of Activity class as follows :

public class MainActivity extends Activity {

}

 

2.       Services:- Service is component that run in the background to perform a long running task or Operation. For example you want to download a file that more then 100 MB and you want move on the other page then you move easily because of async task run for downloading that file. So service is not block the user on same screen.

               

A Service is implemented as a subclass of Service class as follows :

 

public class MyService extends Service {

}

 

3.       Broadcast Receiver:- Broadcast Receiver is respond the broadcast message from the other application or system. for example you receive a call then android system receive a broadcast massage then its fire that message for the action. Broadcast receiver is implemented as subclass of Broadcast Receiver. Every broadcast message receive a message as a Intent Object.

 

A Broadcast Receiver is implemented as a subclass of BroadcastReceiver  class as follows :

 

public class MyReciever extends BroadcastReceiver {

                public void onReceive(context, Intent){}

}

 

4.       Content Provider:- A Content Provider is used to transfer a data from one application to other on request that request is handle by the ContentResolver. The data may be stored into the database or its file system.

A Content Provider is implemented as a subclass of ContentProvider class as follows:

public class MyContentProvider extends 

ContentProvider  {

                public void onCreate(){}

}


Post a Comment

0 Comments