shortcut in Android Studio to locate the current editing src file

Android StudioShortcut

Android Studio Problem Overview


Do you know how to check the location of current editing file in the project tree panel (the very left panel of the Android Studio), except manually. (The worst case is that all the folders there are collapsed)

The Navigate->Class shortcut can show me the src file in edit panel (central panel) quickly. Then I want to know the src file's logic location in project tree (left panel), so that I can add some new files in the same package quickly. (e.g. right-click the package and add new Class).

Currently, I have to expand the project tree and find it folder by folder.

Actually, in Xcode there is such a shortcut named "Reveal in Project Navigate"

What a convenient way it is.

I wonder whether this is also supported in Android studio.

Thanks

Android Studio Solutions


Solution 1 - Android Studio

You can use the Scroll from Source button in the Project Toolbar in the left of Android Studio.

locate

Another solution is Alt+F1+1. You can also read https://stackoverflow.com/questions/1086041/locate-current-file-in-intellij for more answers.

Solution 2 - Android Studio

Just enable the following option!

enter image description here

Solution 3 - Android Studio

For automatic scrolling, you can do following:

You need to ensure Autoscroll to Source and Autoscroll from source is enabled.

auto scroll

Whenever you change the file the Project tree will be highlighted according.

I have observed some slowness and lag if project size is big(several modules or huge code base) and you use short cut Ctrl + N to navigate to a class.

So the alternative would be to either to click following icon: icon

OR

Use keyboard shortcut:

Alt + F1 + 1 or Alt + F1 + Enter

Solution 4 - Android Studio

You can add shortcut (keymap) to "reveal current editing file in project explorer" command.

  1. Press Ctrl + Alt + S, for Windows user, to open Settings
  2. Select Keymap on the sidebar
  3. Find the command using search box, type this into it: select in project view
  4. Right click the result then select Add Keyboard Shortcut
  5. Type any keyboard combination you want, for example, me prefer shortcut Ctrl + K to reveal current editing file on project explorer
  6. Click OK button. It will prompt you to remove keyboard shortcut you typed from existing command, so just click Remove button.

I'm new to android development. I used to code in Sublime Text 3. One of first thing I do to make android development feels more enjoyable is binding all shortcut I used in Sublime Text 3 to Android Studio. Now, it feels like home :)

Solution 5 - Android Studio

In Android Studio 4 it is now Always Select Opened File under the Settings menu in the project view.

enter image description here

Solution 6 - Android Studio

For Mac users: Option+fn+F1, then Enter.

Solution 7 - Android Studio

Android Studio 3.6.3 (April 2020)

Go to Preferences > Keymap & search for "Select in Project View" and assign your keyboard shortcut.

Solution 8 - Android Studio

Under options menu, select Auto scroll from Source

Solution 9 - Android Studio

Navigate -> Select In.. -> Project View -> Project

Solution 10 - Android Studio

open pref -> Keymap, then search 'select file in project view', not 'select opened file'.

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
QuestionRoy MaView Question on Stackoverflow
Solution 1 - Android StudioAliShView Answer on Stackoverflow
Solution 2 - Android StudioPato94View Answer on Stackoverflow
Solution 3 - Android StudioSagarView Answer on Stackoverflow
Solution 4 - Android StudioIfan IqbalView Answer on Stackoverflow
Solution 5 - Android StudiomharperView Answer on Stackoverflow
Solution 6 - Android StudioDr.jackyView Answer on Stackoverflow
Solution 7 - Android StudioTrev14View Answer on Stackoverflow
Solution 8 - Android StudiokaushikView Answer on Stackoverflow
Solution 9 - Android StudioAndrey PetrovView Answer on Stackoverflow
Solution 10 - Android StudioUraka LeeView Answer on Stackoverflow