Android studio helpful tips and tricks
Android studio helpful tips and tricks

I would like to cover 65 Android studio helpful tips and tricks. Android Studio provides the fastest tools for building apps on every type of Android device.

This post covers 20 useful tips and remaining 45 tips are covered in Android studio best 45 tips and tricks

Tips and Tricks

Android studio helpful tips and tricks

1. Code Completion feature

A special variant of the Code Completion feature invoked by pressing Ctrl+Space twice allows you to complete XML tag names from namespaces not declared in the current file. If the namespace is not declared yet the declaration is generated automatically.

Code Completion feature

2. Inject SQL into a string literal

You can inject SQL into a string literal (Alt+Enter | Inject language or reference | ) and then use coding assistance for SQL.

Inject SQL into a string literal

3. Create Kotlin file

Kotlin is a powerful, concise and expressive language crafted by JetBrains. Android Studio supports it out-of-the-box.

To create a Kotlin file, right-click the target folder, and choose the corresponding option on the New menu:

Create Kotlin file

4. Several Kotlin project types

Android Studio provides several Kotlin project types:

Android Studio provides several Kotlin project types

5. Call Java code from Kotlin easily

Android Studio allows you to easily call a Java code from Kotlin:

5. Android Studio allows you to easily call a Java code from Kotlin

6. Easily convert any Java class to the Kotlin one with the same semantics.

One can easily convert any Java class to the Kotlin one with the same semantics.

To do that, just choose Code | Convert Java File to Kotlin File on the main menu:

Easily convert any Java class to the Kotlin one with the same semantics

7. Automatically installs the package you’re trying to import

Intelli J IDEA Community provides a quick-fix that automatically installs the package you’re trying to import: if, after the import keyword, you type a name of a package that is not currently available on your machine, a quick-fix suggests to either ignore the unresolved reference or download and install the missing package.

8. Get access to the most common breakpoint actions and filters

Get access to the most common breakpoint actions and filters through intention actions (Alt+Enter)

Get access to the most common breakpoint actions and filters

9. Easily generate the getter and setter methods for any fields of your class

By using Alt+Insert (Code | Generate) in the editor, you can easily generate the getter and setter methods for any fields of your class.

Easily generate the getter and setter methods for any fields of your class

10. Antivirus protection

If you notice that IntelliJ IDEA Community works slowly, consider reducing the number of folders under antivirus protection. This may significantly improve performance.

11. Quickly enable/disable the breakpoints

Right-click a breakpoint marker in the gutter to quickly enable/disable the breakpoint or adjust its properties.

Quickly enable/disable the breakpoints

12. You can narrow down the list of code completion suggestions by using camel case prefixes.

You can narrow down the list of code completion suggestions by using camel case prefixes.

13. use "CamelHumps"

When you search for a class, file, or symbol press and use "CamelHumps" names to filter the list of results:

14. Show suggestions

When the Show suggestions as you type option is enabled for Code Completion, Ctrl+Down and Ctrl+Up will close it and move the caret down or up in the editor.

15. Move method parameters in both declaration and invocation

You can move method parameters in both declaration and invocation with Ctrl+Alt+Shift+Left and Ctrl+Alt+Shift+Right. Moreover, you can propagate such move in a method declaration to the method invocation: press Alt+Enter after the move and choose Apply signature change.

Move method parameters in both declaration and invocation

16. Sort completion suggestions by relevance or alphabetically

You can sort completion suggestions by relevance or alphabetically.

  • To sort alphabetically, select the Sort by Name option.
  • To sort by relevance, clear the Sort by Name checkbox.
Sort completion suggestions by relevance or alphabetically

17. Regular expression

To verify that your regular expression is correct, place the caret within the expression you want to check, press Alt+Enter, and select Check RegExp.

In the popup frame type a sample string that should match your regular expression. If the background turns green, the match occurred. If it turns red, there is no match or your expression probably contains a mistake.

regular expression

18. Recent clipboard

Press Ctrl+Shift+V to choose from recent clipboard contents chunks and insert it.

19. To close all editor tabs

To close all editor tabs except the current one, keep pressed and click on the current editor tab.

close all editor tabs except the current one

20. Closing tabs

To close all editor tabs, right-click a tab and select Close All. To close all tabs except the active one, press and click on the active tab.

Exited to know more features from Android Studio? Visit the Android studio features page to know more.

Conclusion

In this post I showed you various android studio tips and tricks that you can apply in your day to day programming. If you have any questions or just want to chat with me, feel free to leave a comment below.

One thought on “Android studio helpful tips and tricks

Leave a Reply

Your email address will not be published. Required fields are marked *

Verified by MonsterInsights