I have multi android project in eclipse, when I read source code, I want to know all the reference for one class, but the Ctrl + Shift + G just the search result in the same project. even I click the right menu -- Reference--worksapce.
Related
As you know there is many useful shortcuts that improve you coding speed.
One of them is find usage of Class or Method that works with Alt+F7 or Ctrl+b. they works on methods and class names but I wonder how I can find a Usage of XML file like Layout Without Search in project and use Find Usage.
Because the name of XML file is not in the file Like classes and I Always search it's name in whole project.
I googled but could not find any answer.
All keys are given for windows
CTRL + F for find keywords in a single file
Can do it like this
Find usage of an XML| ALT + F7 after you select the XML layout
There is another way(not sure you gonna like it) ..
Try to delete a xml and it will not be deleted at the first time.It will show you all the usages of it ask you to confirm you deletion. You can see all the usages at the terminal,so that way you can find them all.
click on view usages button it will show them all
For any short-key File -> Settings -> Keymap -> (you can even Choose Eclipse/Visual Studio short key types in android studio)
Here are some default short keys for windows
Format code | CTRL + ALT + L
Add unimplemented methods | CTRL + I
Show logcat | ALT + 6
Build | CTRL + F9
Build and Run | CTRL + F10
Find | CTRL + F
Find in project| CTRL+SHIFT + F
Find and replace | CTRL + R
Find and replace in project | CTRL + SHIFT + R
Override methods | CTRL + O
Show project | ALT + 1
Hide project - logcat | SHIFT + ESC
Collapse all | CTRL + SHIFT + NumPad +
View Debug Points | CTRL + SHIFT + F8
Expand all | CTRL + SHIFT + NumPad -
Open Settings | ALT + s
Select Target (open current file in Project view) | ALT + F1 → ENTER
Search Everywhere | SHIFT → SHIFT (Double shift)
Code | Surround With | CTRL → ALT + T
Create method form selected code | ALT + CTRL
My personal preference is ctrl+shift+f. It will display a popup dialog in which you can type the thing that you are searching and it will look in your entire project folder.
Alternately there is already a Find Usage feature in xml when you right click it. And it does shows the file that uses it.
In my example I did find the use of my analytics_debug.xml then a mini console below will show indicating which file uses it. Selecting the file in usage console redirects you to the exact line of code in which the XML is called.
I reproduce this usecase in Ubuntu 16.04, A.S. version 2.1.1.
From IntelliJ IDEA Documentation:
Finding Usages in the Current File
To find usages of a symbol in the current file:
Click the desired symbol in the editor, or in the Structure view.
On the main menu, choose Edit | Find | Find Usages in File, or press Ctrl+F7. The encountered usage is
highlighted in the editor.
But this didn't work in Linux, instead use ALT+F7
For Mac users the shortcut is
First select the file in project view (⌥ + (fn) + F1)
hit enter to select 1st option or select
show usage of file (⌥ + (fn) + F7)
hit enter to open the file
I can not do Alt Gr + 7or Alt Gr + '-' (|) symbol. When i try to do them, it either opens a new window or shrinks the block of code that my mouse cursor is currently in. In Android Studio ->Settings->Keymaps, i couldnt't find these shortcuts. What is the problem with android studio? how does it expect me to write an app without using { and | symbols? How can it steal important code shortcuts?
In Android Studio (IntelliJ) how do you execute a 'File Search' for a string within a Scope of files? Can Search Everywhere do this, I only see how to use it to search 'code', not 'files'
Example: Search for the string "Dummy Button" in the 'Workspace Scope'.
Expected Response: res/values/string.xml:line4
You can do it in two ways,
Goto Menu -> Edit -> Find -> Find in Path
Or use the shortcut,
ctrl+shift+f
In Android Studio,
On a Windows or Linux based machine use shortcut Ctrl + Shift + F to search any string in whole project. It's easy to remember considering Ctrl + F is used to search in the current file. So just press the Shift as well.
On OSX use the Command key instead of Ctrl.
Use Ctrl + F combination for Windows and Linux to search in current file.
Use Shift + Shift (Double Tap Shift) combination for Windows and Linux to search Project File of Project.
Command+Shift+F on Mac to find in path
In Android Studio 4.1 update, the combination for Mac users changed, now you should use Control + Shift + f.
Try this. Enter your string name in dialogue box after pressing ctrl+shift+f
Menu Bar->Edit->Find->Find in Path...
Press Two times Shift button and write in search box it will search in whole Android studio.
In my case, I accidentally checked the box of "File mask". So all xml files are not searchable in Find in Path. Maybe this can help you.
How can one move to previous caret position(s) in android studio?
It was possible in Eclipse.
Use Ctrl + Alt + Left and Ctrl + Alt + Right
For Mac, use Command + Option + Left and Command + Option + Right
If these don't work for you, it is possible that these keys are assigned for some of the functions of your OS/video drivers, you can either disable the shortcuts that are using these keys from operating system settings/video driver settings or change shortcuts from Android Studio itself by going to:
File > Settings > Keymap > Main menu > Navigate > Back/Forward
Mac users can find this dialog by going to Android Studio's: App Menu -> Preferences
It's Alt + Ctrl + Right/Left arrow and mouse buttons 4 and 5 (if your mouse has those). You can change these shortcuts under:
File > Settings > Keymap > Main menu > Navigate > Back/Forward.
Another option : move to the last edit location: CTRL + SHIFT + BACKSPACE
Move to the last cursor position: CTRL + ALT + left Arrow
In Android Studio, go to View and check the ToolBar option. It will show the Back and Forward buttons.
cmd + [ and cmd + ] will move your caret to the previous and next positions.
Confirmed on Android Studio v2.3.3 / MacOS
Use Ctrl + Alt + Left and Ctrl + Alt + Right
For Mac, use Command + Option + Left and Command + Option + Right
If these don't work for you, it is possible that these keys are assigned for some of the functions of your OS/video drivers, you can either disable the shortcuts that are using these keys from operating system settings/video driver settings or change shortcuts from Android Studio itself by going to:
File > Settings > Keymap > Main menu > Navigate > Back/Forward
Mac users can find this dialog by going to Android Studio's: App Menu -> Preferences
For Windows/Linux : Ctrl + Alt + Left / Right
For Mac : Cmd + Alt + Left / Right
Another option : move to the last edit location: CTRL + SHIFT + BACKSPACE
Move to the last cursor position: CTRL + ALT + left Arrow
cmd + [ and cmd + ] will move your caret to the previous and next positions.
Confirmed on Android Studio v3.0.1 / MacOS High Sierra Version 10.13.3
Ubuntu 19-04 (Gnome)
navigate back = alt + shift + left
navigate forwards = alt + shift + right
Source
If you don't want to use keyboard shortcuts, goto view >> Toolbar and check it (if its unchecked) as shown below
Doing this will add two shortcuts below menu options to navigate forward and backward like shown below
For those coming from Eclipse, you can have Android Studio use Eclipse style keyboard mappings. Keep in mind host OS can still intercept keystrokes and prevent some keystrokes from working as desired in both Eclipse and Android Studio. If you want to give it a try, here is where to switch it:
In Android Studio, go to View and check the ToolBar option. It will show the Back and Forward buttons.
cmd + [ and cmd + ] will move your caret to the previous and next positions.
Confirmed on Android Studio v3.0.1 / MacOS High Sierra Version 10.13.3
In MacOS
Go to Preferences -> Keymap,
Confirm that you have macOS selected in dropdown.
Now go back to editor, press cmd + [ or cmd + ] to navigate.
In recent Android Studio versions, to enable back arrow on toolbar, go to:
View -> Appearance -> Toolbar
In Android Studio BumbleBee | 2021.1.1,
Just Click
View -> Appearance -> Check Toolbar
And you will see a right and left array to navigate
cmd + [ and cmd + ] will move your caret to the previous and next positions.
Confirmed on Android Studio v2.3.3 / MacOS
For Windows/Linux : Ctrl+Alt+Left / Right
For Mac : Cmd+Alt+Left / Right
Ubuntu 19-04 (Gnome)
navigate back = alt + shift + left
navigate forwards = alt + shift + right
I just do this in android emulator for copying and pasting the data in edittext.
Ctrl + C = Copy
Ctrl + V = Paste
But it didn't works. So, i need to know if these shortcuts are working or not in emulator. Or, any other special shortcuts available for android emulator. Anyone knows this means, help me to find out the problem? Hope this will very useful for me. I'm working on Windows 7 Professional OS.
You can see the shortcuts by clicking on the "more" button:
And going to the "Help" tab:
For more information: Android Emulator.
You can check current config from console
emulator -help-keys
When running the emulator, use the following keypresses:
Ctrl-H Home button
Ctrl-M Menu (Soft-Left) button
Ctrl-Backspace Back button
Ctrl-Escape Power button
Ctrl-Equal Volume up button
Ctrl-Minus Volume down button
note that NumLock must be deactivated for keypad keys to work
Copy the text you want:
Ctrl + C = Copy
Then when the emulator is in focus, paste using:
Ctrl + V = Paste
Then in the edit text that you want, long click on the field until you see the emulator paste button pop up above your cursor. Click that and it should work.
In the Android Studio Emulator the ctrl+v doensn't works, just hold the left mouse button for a second and paste menu will appear (in textbox etc.).
For Mac OS, the most important shortcuts are:
Cmd + Backspace: Back button
Cmd + O: Overview (The square button)
Cmd + Shift + H: Home (The center button)
You can see the rest from the Triple Dot menu, go to Help section.