# Android Studio Tips ![image](https://hackmd.io/_uploads/BkoK5iv31e.png) | Tip/Shortcut | Description | | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | **Basic Editing & Navigation** | | | Parameter Info | `Ctrl + P` (or `Cmd + P` on Mac) to view parameters for a method/constructor | | Type Info | `Ctrl + Shift + P` (or `Cmd + Shift + P` on Mac) to check the type of a variable | | Show Intention Actions | `Alt + Enter` (or `Option + Enter` on Mac) to see suggestions and quick fixes | | Code Completion | `Ctrl + Space` (or `Cmd + Space` on Mac) to see available options within an XML tag or on a view | | Extract Method | `Ctrl + Alt + M` (or `Cmd + Option + M` on Mac) to generate a method from selected code | | Surround With | `Ctrl + Alt + T` (or `Cmd + Option + T` on Mac) to surround code with if statements or try-catch blocks | | Precise Selection | Hold `Shift` and use left/right arrow keys to select characters; add `Ctrl` (or `Cmd` on Mac) for whole words | | Move Lines | `Ctrl + Shift + Up/Down` (or `Cmd + Shift + Up/Down` on Mac) arrows to move lines of code | | Refactor/Rename | `Shift + F6` to rename variables, methods, or classes | | Switch Between Tabs | `Alt + Left/Right` (or `Cmd + Option + Left/Right` on Mac) arrows to navigate between open tabs | | Navigate Methods and Classes| `Alt + Up/Down` (or `Cmd + Option + Up/Down` on Mac) arrows to jump between different methods and classes | | Select by Indentation | Use the middle mouse button to select code by indentation | | Reformat Code | `Ctrl + Alt + L` (or `Cmd + Option + L` on Mac) to reformat and properly indent your code | | Comment Block | `Ctrl + Shift + /` (or `Cmd + Shift + /` on Mac) to comment or uncomment a block of code | | Show Errors and Warnings | `Alt + 6` (or `Cmd + 6` on Mac) to display all errors and warnings in your project | | Navigate to Last Edit Location| `Ctrl + Shift + Backspace` (or `Cmd + Shift + Backspace` on Mac) to return to the last place you edited | | Navigate Between Errors | `F2` to jump between errors in your code, `Shift + F2` to jump backwards | | Customize Keymap | Go to `File > Settings > Keymap` (or `Android Studio > Preferences > Keymap` on Mac) to customize or create your own key shortcuts | | Macros | Record and replay actions via `Edit > Macros > Start Macro Recording`. Assign a shortcut in Keymap settings | | Find Usages | `Alt + F7` (or `Option + F7` on Mac) to find where a method or variable is used | | Go to Declaration | `Ctrl + B` (or `Cmd + B` on Mac) or `Ctrl + Click` (or `Cmd + Click` on Mac) to jump to the declaration of a variable, method, or class | | Go to Implementation | `Ctrl + Alt + B` (or `Cmd + Option + B` on Mac) to go to implementation(s) of an interface or abstract method | | **Debugging** | | | Start Debugging | `Shift + F9` (or `Ctrl + D` on Mac) to start debugging the app | | Step Over | `F8` to execute the current line and move to the next | | Step Into | `F7` to step into a method call | | Step Out | `Shift + F8` to step out of the current method | | Run to Cursor | `Alt + F9` (or `Option + F9` on Mac) to run the program until the cursor position | | Evaluate Expression | `Alt + F8` (or `Option + F8` on Mac) to evaluate an expression during debugging | | Set/Remove Breakpoint | `Ctrl + F8` (or `Cmd + F8` on Mac) to toggle a breakpoint | | View Breakpoints | `Ctrl + Shift + F8` (or `Cmd + Shift + F8` on Mac) to view and manage breakpoints | | **Layout Editor** | | | Preview Layout | `Shift + Alt + Enter` (or `Shift + Option + Enter` on Mac) to preview the current layout | | Switch Between Design/Text | Click the "Design" and "Text" tabs at the bottom of the layout editor | | Constraint Inference | Click the "Infer Constraints" button in the layout editor toolbar | | **Version Control** | | | Commit Changes | `Ctrl + K` (or `Cmd + K` on Mac) to commit changes to the version control system | | Update Project | `Ctrl + T` (or `Cmd + T` on Mac) to update the project from the version control system | | Show History | Right-click on a file and select "Git > Show History" to view the file's history | | **Gradle** | | | Sync Project with Gradle Files | Click the "Sync Project with Gradle Files" button in the toolbar or `File > Sync Project with Gradle Files` | | Open Gradle Console | Click the "Gradle" tab in the bottom tool window |