"Add unimplemented methods" feature in the Android Studio

AndroidAndroid Studio

Android Problem Overview


In the Eclipse IDE there is a great feature allows you to add (implement) all of the required methods of the particular class. I'm looking for this feature in the Android Studio IDE, but without success so far. Is there something similar? For me it is one of the key-features and can't live without.

edit:

I don't want to choose methods to implemet. I want IDE to do it for me like Eclipse were doing. For example when I clicked "Add unimplemented methods" inside any Activity extented class all of these onCreate() onPause() onResume() were generated.

Android Solutions


Solution 1 - Android

Of course there is. It is called Implement methods or Override Methods. The default shortcut is CTRL-I and CTRL-O. See descrption of Implementing Methods and Overriding Methods.

Solution 2 - Android

You can use following shortcuts.

On Windows machine:

  • Alt + Enter - on class definition;
  • Ctrl + I - in class body to show list of unimplemented methods.

On Mac:

  • Option ⌥ + Return - on class definition (Option ⌥ can be also Alt);
  • Command ⌘ + I - in class body to show list of unimplemented methods.

There is also useful combination Ctrl + O / Command ⌘ + O - override methods.

Solution 3 - Android

On Mac, this is easy with Command + N. This brings up a menu that asks if you want to access the override methods or the interface methods, combining the shortcuts described in the other answers. There is a similar shortcut on Windows, but it's not as convenient.

The source, should they ever change: https://www.jetbrains.com/idea/help/generating-constructors.html

EDIT: or, for interfaces: https://www.jetbrains.com/idea/help/implementing-methods-of-an-interface.html

and supers: https://www.jetbrains.com/idea/help/overriding-methods-of-a-superclass.html

Solution 4 - Android

Alt + Enter - on class definition; Ctrl + I - in class body to show list of unimplemented methods. Ctrl + O - in class body to show list of override methods.

Solution 5 - Android

Type buttonName.setOnClickListener(new ) after that using Ctrl+Shift+Space you will get you the right choices.

Ctrl+Shift+Enter will make your code syntactically correct

Solution 6 - Android

Though the question is 1 year ago, but this might help for future users.
For windows users, Alt + Enter > Implement methods ( press Enter ) > ( press Enter) works.
This will add the unimplemented methods.
But you've to move your cursor next to that class or interface.

Solution 7 - Android

In linux, Alt+Insert will provide list to implement constructor, setter, getter and implemented method like toString

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionXorOrNorView Question on Stackoverflow
Solution 1 - AndroidGrzegorz ŻurView Answer on Stackoverflow
Solution 2 - AndroidpbespechnyiView Answer on Stackoverflow
Solution 3 - AndroidmanroeView Answer on Stackoverflow
Solution 4 - AndroidEster KaufmanView Answer on Stackoverflow
Solution 5 - AndroidDennis MPView Answer on Stackoverflow
Solution 6 - Androidssi-anikView Answer on Stackoverflow
Solution 7 - AndroidAnis AjmeriView Answer on Stackoverflow