I know how to find the source by using ctrl + left click on a method, for example, but what if I want to find where this method is used? I'm using Windows 7.
Let's suppose I have the following method:
class A {
public int sum(int a, int b) {
return a+b;
}
}
and I am using this method in
class B {
...
a.sum(c, d);
...
}
and I want to find where I used sum
while I was in class A
.
PS: I'm new to Android studio (started using it about a month ago).
In Android Studio, highlight the method and either right click > Find usages or use the Alt + F7 shortcut.
Edit: Ctrl + left click on a method is useful for finding where that method was initially declared
For Ubuntu users:
For me Alt + F7 has not worked, so I've solved the conflict by going to the
Ubuntu System settings-> keyboard -> shortcuts
and changing Alt + F7 in there with another combination.
And now it's working ))
只需单击方法或变量,任何用法都会突出显示,在代码右侧的滚动条上,您会看到灰色条出现,这些是当前突出显示(或单击)的变量或方法在您的代码中的用法代码。
To find all uses of a variable or method in Android Studio you can use
Here are different key shortcuts for displaying method or variable usage. The keymaps with F14 in them were added by me; the others are default. For Windows (and Linux?), replace the ⌘ key with Ctrl (I think). Find Usages shows them in a dedicated window in Android Studio (the solution in other answers), while Show Usages puts them in a popup (second image below).
使用 [Ctrl+b] 或 [Ctrl+Alt+b] 导航到方法的原点或变量的清除和实现
Ubuntu is Ctrl+Alt+7
or Ctrl+b
to show the usage of the class. Ctrl+Alt+F7
is not work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.