Othman Othman - 1 month ago 18
Android Question

Activities, services, broadcast receivers - Android Terminology

I'm new to android development and I'm trying to learn the proper terminology.

Are activities, services, broadcast receivers and content providers classes or classes instances (objects)?

(I've seen activities referred as classes or objects depending on the book or tutorial).

Answer

Android is based on Java , and Activity, Services,Broadcast Receivers are all classes which extends a Common Root class Object.

So you can implement all the Object Oriented Programming Concepts with these classes.

Below is the Hierarchy of an Activity in Android system, similarly it is applicable for others too.

public class Activity 
extends ContextThemeWrapper implements LayoutInflater.Factory2,     
Window.Callback, KeyEvent.Callback, View.OnCreateContextMenuListener, ComponentCallbacks2


java.lang.Object
   ↳    android.content.Context
        ↳   android.content.ContextWrapper
           ↳    android.view.ContextThemeWrapper
               ↳    android.app.Activity

For more info you can check developers.android.com

Comments