Android Studio: (About) 10 Things You (Probably) Didn’t Know You Could Do

Android Studio: (About) 10 Things You (Probably) Didn’t Know You Could Do


In this “Android
Tool Time” pro tip, I’m going to show you
some Android Studio expert tips to keep you in the zone
and increase your productivity. [MUSIC PLAYING] You’re probably already
familiar with some of the most common
shortcuts– turning on automatic importing of
unambiguous class names, pressing Shift twice
to search everywhere, or using Shift-F6 to rename
a variable, method, or class. So we’ll skip past those and
try something a little more nuanced than that. Here, I need to change
the duplicated method to set latitude. I can bring up Auto
Complete to make life easy with Control-Space. But when I select
the right method, it annoyingly inserts a new
method in front of the old one. Unless I hit Tab
instead, in which case, it’ll replace the old
method with the new one. Similarly, if I hit
Control-Shift-Space, I get only suggestions
of the expected type. And after I make the
selection, hitting Tab will replace the old value. For both Control-Space
and Control-Shift-Space, hitting the shortcut
a second time will suggest auto
completion options based on chained expressions,
collections, lists, and arrays. You already know how to navigate
your code using the cursor keys and using Alt-Left and
Right to skip across words and holding Shift
to select them. But did you know
you can use Alt-Up to extend your selection
to the next containing node and Alt-Down to
correspondingly shrink your selection? Once selected, use Alt-Shift
Up or Down to move the code. Use postfix code completion
to transform an already typed expression into another
one, such as creating a full loop over a list
or turning an expression into an if statement. You can use Command-J to see all
the valid postfixes for a given context. For more complex
patterns, use live templates to insert
templated code snippets. For example, using
a toast shortcut makes it easy to add an
new toast where only need to specify the text to display. There are dozens of
generic and Android specific live
templates, including a selection of
logging shortcuts, including log M that
inserts the current method name and the name and value of
each parameter passed into it. Easier log statements
are great for debugging, but did you know
you can also set conditional breakpoints that can
log the output of expressions? It’s also possible
to define a custom rendering for objects while
you’re evaluating expressions rather than relying on
their two-string values. There are so many handy
features in Android Studio that it’s easy to forget
all those shortcuts. Luckily, you just
need to remember one– Command-Shift-A–
and start typing keywords to find them. For example, the
Structural Search feature lets you search
for code patterns without resorting to
regular expressions. If you enable Structural Search
Inspection and borrow a mouse, you can even provide warnings
around methods and syntax that you wish to discourage
within your code. Similarly, you can use the
Structural Replace feature to find and replace deprecated
code or common anti-patterns. And use Structural
Search Inspection here to offer a replacement
snippet as a quick fix option. There are hundreds
of tips and tricks to make your Android
Studio experience faster, more productive, and
mostly mouse-free. Subscribe to Android
Developers on YouTube and tune into “Android Tool
Time” for more Android tool time pro tips.

66 thoughts to “Android Studio: (About) 10 Things You (Probably) Didn’t Know You Could Do”

  1. Great video! Love the tips, and I love the speed of the video. Videos like this are often tediously slow, but this moved along at a great pace.

  2. I've been trying to find that tab auto complete for months! thanks Reto.
    I love the no nonsense professionalism of the video too. thanks!

  3. Amazing but super dense, some people probably dig it but I prefer not to jump back in a video every 10 seconds. Thanks for the great info

  4. it was like to teach new song to play on piano from first time, fast, and without a break) but ofc we could use PAUSE…

  5. I really wish one could interact with Android Studio as fast as it is being shown here in Video. Java Desktop Apps are SHIT and you took it for IDE!!

  6. Holy balls, this is amazing! But extending selection was CTRL+W for me instead of ALT+UP, similarly CTRL+SHIFT+W for shrinking selection instead of ALT+DOWN.

  7. The video is very helpful… but could you please slow it down a little bit..English is not my primary language… so it bit difficult to follow what you are speaking..

  8. Nice, but next time pretend you are on an hourly rate rather than salary, this was (as many have already noted) far too quick.

  9. plz help me google i was unlocking my boot loader on my nexus 5 and then it got stuck in boot loop plzzzzz help me i m crrying over here plz plz plz help me google i need ur help plzzz

  10. I'm using Mac OS X and already knew most of these shortcuts, but now, I also use Android Studio on WIndows 10. I switched to Mac OS X 10.5+ keymap to prevent myself from having to learn all shorcuts from scratch, but now, the command key which should be recognized as command (aka meta) by the keymap doesn't do anything… 🙁

  11. I have a question, recently my s6 edge plus was factory reset on accident and now i lost all my precious pictures and videos, text, call logs, and I'm freaking out… is there anyway I can get it back somehow? I haven't use my phone for 3 days now…

  12. Not only are you covering things too quick, but the key shortcuts appear on screen for FAR too short of a time!
    At least the tips are linked in the description

  13. I don't know why there is no an App editor like an text editor(without coding, just dropping; texting; drawing and changing proprieties)
    Android Studio is 2GB large, but a Google Docs online and offline too is so little and efficient.
    I hope Google turns the things easy.

Leave a Reply

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