Android Studio Tip #6 – Multiple Cursors

I have heard before about this “ability” of Android Studio of having multiple cursors active at the same time, but I haven’t found it very useful until today. You can see what I am talking about in the gif below:

Press ALT + SHIFT and left click on the mouse and select the position of each cursor.


As you can see, this feature is really cool :D

Android Studio Tip #5 – Autocomplete “for” statement

When you want to write a for statement most of you guys (or at least me :P) start to write character by character “for (int i = 0; i < list.size(); i++)”. Well Android Studio makes this easier for us and we can avoid writing that much by using a combination of 2 keys:


If you are inside a method and you want to generate a for statement you just have to press CTRL + J and select fori option from the dialog. You will just have to fill in the size of the list.



As you can see, there are more options from where you can choose. So you can generate iterators and other stuff, not just the for statement. So please feel free to try more of these options :D

Android Studio Tip #4 – Automatic Negation

Sometimes, (in fact, many times :P) you have to negate boolean expressions, and in order to do that, you write the expression and after that you go back to the beginning to add “!”, am I right? :D

Well, you can avoid doing this, by pressing the “!” instead of Enter when you use autocomplete. Just make sure the option from the autocomplete dialog is selected (it must be blue).