How to jump to class or method implementation in Android Studio
Asked Answered
V

6

15

With Eclipse I would just hover over class or method name and CTRL+? to jump to the implementation. Even if it was an import I was interested in I could jump to the implementation.

In Android Studio, how is this done for methods and classes?

I don't think CTRL+Alt+7 is what I want. I want to go to where the code is written for the type or method defined that the cursor is hovering over or selected.

I've got lots of code to review so I would appreciate an answer for this.

I'm on a PC but I would like to know for Mac as well.

Vacillatory answered 26/1, 2016 at 9:16 Comment(0)
G
24

You can jump to the implementation with:

  • CTRL + left click on method

or

  • Scroll-click on method

as in Eclipes

The following are used in Android Studio:

Add unimplemented methods: CTRL + I

Override methods: CTRL + O

Format code: CTRL + ALT + L

Show project: ALT + 1

Show logcat: ALT + 6

Build: CTRL + F9

Build and Run: CTRL + F10

Expand all: CTRL + SHIFT + NumPad -

Find and replace: CTRL + R

Find: CTRL + F

You can change shortcuts by following below :-

This section lists Android Studio keyboard shortcuts for the default keymap. To change the default keymap on Windows and Linux, go to File > Settings > Keymap. If you're using Mac OS X, update your keymap to use the Mac OS X 10.5+ version keymaps under Android Studio Preferences > Keymap.

Here is Official documentation for Android studio tips and shortcuts

For Mac: Android Studio Shortcuts for Mac OS

Goraud answered 26/1, 2016 at 9:19 Comment(0)
R
6

...to jump to the implementation...
In Android Studio, how is this done for methods and classes?

The keyboard shortcut you are looking for is:
Ctrl + B

It could also be done by using the mouse:
Wheel/Middle Click on method / classes

Or by using both the mouse and the keyboard:
Ctrl + Left Click on method / classes

Another useful shortcut:
Method search Ctrl + F12 or (Navigate -> File Structure).

Rupee answered 28/12, 2021 at 15:0 Comment(2)
for example there are two methods call method1() and method2() .when i call method2() inside method1() ,and if i click method2() and press CTRL+B it will bring me to method2. But how can back to method1() .is there any methods for it?. it is very use full for large project .Absher
To go back to method1, use the shortcut shown in the Navigate menu for "Back"Standee
K
4

CTRL + Left Click should work, just as in Eclipse!

Konstantin answered 26/1, 2016 at 9:28 Comment(2)
How to do same thing without using mouse ?Frigate
try CTRL+B (with shift or alt for other variants)Konstantin
E
0

On mac you can use this shortkey:

enter image description here

And if you are comforable to eclipse,you can change your keymap to exlipse in here: enter image description here

Expeller answered 26/1, 2016 at 9:21 Comment(0)
M
0

I know this is old question but I found the solution for myself. It is CTRL+ F12 for Method search and its name is File Structure(Main menu -> Navigate -> File Structure) keymap.

For Class search you can use CTRL + N. Its name is Go to Class(Main menu -> Navigate -> Go to Class) in keymap.

You can change their defaults in given paths in Setting -> Keymap.

Mutualism answered 26/6, 2021 at 18:43 Comment(0)
P
0

I am using Flutter for app development. But I am also using native Android (Kotlin) with flutter for the app development.

So in Android studio, jumping into classes written in Kotlin was not working if I opened the whole flutter project.

So solution is to open only android folder in the Android studio, instead of whole project where flutter files (lib folder) is also present.

Then I was able to use cmd + mouse (or ctrl + mouse for Windows) to jump into the Kotlin classes.

enter image description here

Pewit answered 20/9, 2021 at 8:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.