Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the Usage of Android Super Class?

Tags:

android

friends,

any one guide me what is the purpose of Super class in android i have seen in many @Override methods. for example

@Override
        protected void onProgressUpdate(final Object... args) 
         {   super.onProgressUpdate(args);
}

@Override
        protected void onPostExecute(Boolean result) {
            super.onPostExecute(result);
}

@Override     
        protected void onPreExecute() {
            super.onPreExecute();
}

any help would be appreciated.

like image 977
UMAR-MOBITSOLUTIONS Avatar asked Apr 27 '11 10:04

UMAR-MOBITSOLUTIONS


People also ask

What is the purpose of super in Android?

It is used to call superclass methods, and to access the superclass constructor. The most common use of the super keyword is to eliminate the confusion between superclasses and subclasses that have methods with the same name.

What is super class in Android?

The superclass of a class is the class that the class was extended from, or null if it wasn't extended. for example, say you have a class called object, containing an onDestroy() method.

What does super () do?

Definition and Usage. The super() function is used to give access to methods and properties of a parent or sibling class. The super() function returns an object that represents the parent class.

What is use of application class in Android?

The Application class in Android is the base class within an Android app that contains all other components such as activities and services. The Application class, or any subclass of the Application class, is instantiated before any other class when the process for your application/package is created.

Can we use super super in Java?

Your code would break if you called a super of a super that had no super. Object oriented programming (which Java is) is all about objects, not functions. If you want task oriented programming, choose C++ or something else.

What is super class in Java?

Definitions: A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class).


1 Answers

The superclass of a class is the class that the class was extended from, or null if it wasn't extended.

for example, say you have a class called object, containing an onDestroy() method. If you then make a class based on object, called textbox, that extends(inherits) object, and thus has all the methods found in object. If you have no onDestroy() specifically for textbox, the onDestroy() inherited from object would get called, if you create your own onDestroy() to override the one from object that one will be called instead.

To make sure you are not missing important functionality that should come with textbox being an object, such as correct memory management when destroying the class, it's important to also do what would be done for an object, not only what you want to do for your textbox, this is done by calling the super.onDestroy(), which in this case would essentially call object.onDestroy().

like image 109
Nisse Avatar answered Sep 28 '22 16:09

Nisse