Android tutorial - How to Implement Abstract Method in Android Studio | Abstract Method - android studio tutorial
What Is Abstract Method:
- The methods without body or methods with only signatures are called abstract methods.
- The abstract method doesn’t have any implementation details.
- It is declared using abstract keyword before method name.
- For example, calling method is an abstract method.
Syntax: of Abstract Method:
Note:
- In order to use abstract method, we first need to override that method in subclass (i.e. child class).
Ways to Implement Abstract Method in Android Studio:
Method 1:
- The manual method for this in android studio is simply go to menu bar click Code -> Generate.
- On clicking will open a pop up then click over Implement Methods.
- Further a window will open select the methods and click ok, this will implement the abstract method.
Method 2:
- In this method, just remember the shortcuts for the same task. Control + I will open the window to select implement method and click ok. Same shortcut for Mac also.